Reinforcement Learning
Source: Concepts adapted from Ace the Data Science Interview — Chapter 7 (“Machine Learning”) by Kevin Huo & Nick Singh. Rewritten in original wording for this course.
Reinforcement learning (RL) sits outside supervised and unsupervised learning. An agent takes actions in an environment, visits states, and receives rewards. The goal is to learn a behavior that maximizes long-term return — not to imitate labeled “correct” outputs.
Famous use cases: games (AlphaGo, chess, StarCraft) and robotics. Prefer RL when the problem is decisions over time and you do not already know the right action labels (supervised assumes you do). Unless RL is on your résumé, most DS interviews will not drill it deeply — still know the vocabulary.
Core components
| Piece | Role |
|---|---|
| Reward function | Scores good vs bad outcomes in a state (defines the goal) |
| Policy | Maps states → actions (how the agent chooses) |
| Model | Predicts next state / reward given (state, action) — optional; model-free methods skip an explicit dynamics model |
| Value function | Predicts expected discounted future return from a state (or state–action); re-estimated as the agent learns |
Learning loop: act → observe reward & next state → update policy / values → repeat.
RL basics
1 / 4RL differs from supervised learning mainly because…
Pick an answer to see if you are right.
Discounting, exploration, Q-learning
Return with discount :
One-step Bellman sketch: .
Q-learning (model-free) updates action-values: