Learn the complete Git/GitHub workflow for team collaboration
First, let's make sure you have Git installed and clone the repository.
git --version
You should see something like git version 2.x.x
Your instructor will provide the repository URL. Clone it to your machine:
git clone https://github.com/YOUR-ORG/w19d2-qlearning.git
cd w19d2-qlearning
git remote -v
You should see origin pointing to the GitHub repository.
What does git clone do?
Branches let you work on features without affecting the main code. Each team member creates their own feature branch.
Make sure you're on your team's branch first:
git checkout team-a # Replace with your team name
Name your branch based on your improvement area:
git checkout -b feature/learning-rate # Your improvement
Branch naming conventions:
feature/learning-rate - For learning rate improvementsfeature/exploration - For exploration strategiesfeature/state-bins - For state representation changesfeature/reward-shaping - For reward shapinggit branch
The asterisk (*) shows your current branch.
main or your team branch. Always create a feature branch!
Now you'll edit w19d2_starter.py to implement your improvement.
In your code editor, open w19d2_starter.py. Look for sections marked with:
# ========== MODIFY HERE ==========
def get_learning_rate(self, state=None):
# ========== MODIFY HERE: LEARNING RATE STRATEGY ==========
# Default: Fixed learning rate
# BEFORE: return self.learning_rate
# AFTER: Decay learning rate over time
return self.learning_rate * (0.999 ** self.total_updates)
Run the script to train and see live graphs:
python w19d2_starter.py
The script auto-manages a virtual environment and shows a matplotlib training graph.
git status
This shows which files have been modified.
git diff w19d2_starter.py
This shows the exact lines that changed.
A commit is a snapshot of your changes with a message describing what you did.
Tell Git which files to include in the commit:
git add w19d2_starter.py
git status
You should see your file listed under "Changes to be committed".
git commit -m "Add adaptive learning rate decay"
What's the difference between git add and git commit?
Now let's upload your branch to GitHub so others can see your work.
git push -u origin feature/learning-rate
The -u flag sets up tracking, so future pushes just need git push.
Go to your repository on GitHub. You should see a message about your recently pushed branch:
If you make more changes later, you can:
git add js/qlearning.js
git commit -m "Improve learning rate decay formula"
git push
A Pull Request (PR) asks to merge your branch into the team branch. It's where code review happens.
team-a)Add adaptive learning rate decay strategy
## Summary
Implemented exponential learning rate decay to improve convergence.
## Changes Made
- Modified `getLearningRate()` in qlearning.js
- Learning rate now decays by 0.999 per update
## Evaluation Results
- Baseline: 180 ± 45
- After change: 235 ± 52
- Improvement: +30%
## Testing
- [x] Trained with seed=42, 500 episodes
- [x] Ran 100-episode evaluation
- [x] Exported Q-table as evidence
Add your teammates as reviewers. They'll check your code before it can be merged.
Code review ensures quality and shares knowledge across the team.
If reviewers request changes:
Once approved, click the "Merge pull request" button. Your code is now part of the team branch!
git checkout team-a
git pull