Module 09 / 17
Reinforcement Learning
Learn how AI agents make decisions through rewards, simulation, and policy evaluation.
01 Sequential Decision Problems
Reinforcement Learning (RL) models decisions as a Markov Decision Process: an agent observes a state, chooses an action, then receives a reward and a new state. Policy π(a|s) chooses actions while discount factor γ weights future rewards. In Gymnasium's CartPole, the agent receives +1 while the pole remains upright.
02 Value Functions and Q-Learning
Value-based RL estimates the long-term value of a state or state-action pair. Q-learning updates Q(s,a) with α[r + γ max Q(s′,a′) − Q(s,a)]. ε-greedy exploration occasionally tries a random action; DQN replaces the table with a neural network and uses replay buffers plus a target network for more stable Atari training.
03 From Policy Gradient to PPO
For continuous actions such as a robot arm angle, a policy can output an action distribution. REINFORCE learns from episode rewards, actor-critic adds a value estimator, and PPO limits how much the policy changes per update. Stable-Baselines3 provides practical PPO, DQN, and SAC implementations.
04 Reward Design and Evaluation
A badly designed reward can optimize the metric while missing the real goal. For a warehouse robot, add collision, energy, and waiting-time penalties instead of rewarding speed alone. Compare several random seeds in a separate evaluation environment, then use MuJoCo or Isaac Sim, domain randomization, action limits, and an emergency stop before moving to hardware.