Reinforcement Learning and Q-Learning
Reinforcement Learning (RL) is a paradigm where an agent learns to make sequences of decisions in an environment to maximize its cumulative long-term reward.
Markov Decision Processes (MDP)
An MDP provides a formal mathematical framework for modeling decision-making under uncertainty, defined by:
- States (): The set of all possible environmental states.
- Actions (): The set of actions available to the agent.
- Transition Probability : The probability of transition to state given action in state .
- Reward Function : The immediate reward received after transitioning.
The Bellman Optimality Equation
The objective is to find a policy that maximizes the expected discounted return , where is the discount factor.
The optimal action-value function satisfies the Bellman Optimality Equation:
Q-Learning (Model-Free Control)
When transition probabilities are unknown, the agent learns -values through experience using temporal difference updates:
where is the learning rate, and is the immediate reward.
Deep Q-Networks (DQN)
In large state spaces, we replace the lookup table with a neural network parameterized by weights . We train the network by minimizing the loss against a target value:
where represents the weights of a separate target network updated periodically to stabilize training. We use an Experience Replay Buffer to store state transitions, breaking sample correlation and stabilizing updates.
Example: Q-Learning Update Step
The following example demonstrates a single Q-learning update step:
Interactive Lab
Perform a Temporal Difference (TD) Q-learning update calculation for a single state transition, updating its action-value rating.
Exercise
Test your understanding of the discount factor parameter:
What happens to an RL agent's behavior if the discount factor gamma is set close to zero?
Dimensional Complexity
Tabular Q-learning is limited to small discrete environments. Continuous, high-dimensional spaces require deep neural network function approximators (DQNs).