PROJECTENGRAM

Q-LEARNING

Q-Learning

Tags: #◇Computer Science #◇CSINTSY #◇Q-Learning #◇Problem Solving #◇M6


◇Overview

Q-Learning is a Reinforcement Learning algorithm used when the agent does not know the transition probabilities or the reward distribution of an environment beforehand. Because the agent lacks a model of the world (unlike in MDPs), it must learn the optimal policy by exploring the environment and experiencing the rewards and transitions firsthand.

Q-Table:
The algorithm uses a lookup table (Q-table) to store the estimated Q-values for every state-action pair. The Q-value represents the expected total cumulative reward of taking a specific action from a specific state and acting optimally thereafter.

Exploration vs. Exploitation:
During training, the agent faces a trade-off: Exploration: Taking random actions to discover new states and potentially higher rewards. Exploitation: Choosing the best-known action based on current Q-values to maximize reward.
Typically, agents start with high exploration and gradually shift to exploitation as they learn the environment.

Deep Q-Learning:
For environments with vast or continuous state spaces, maintaining a Q-table becomes impossible. Deep Q-Learning replaces the Q-table with a deep neural network that approximates the Q-value for any given state-action pair.

◇Important Formulas

Q-Learning Update Rule:
When an agent takes action aa in state ss, transitions to state s′s', and receives reward RR, the Q-value is updated:
Q(s,a)←(1−α)Q(s,a)+α(R+γmax⁡a′Q(s′,a′))Q(s, a) \leftarrow (1 - \alpha) Q(s, a) + \alpha \left( R + \gamma \max_{a'} Q(s', a') \right)
Where: α\alpha is the learning rate. γ\gamma is the discount factor. max⁡a′Q(s′,a′)\max_{a'} Q(s', a') is the highest expected reward from the next state s′s'.

◇Worked Examples

Frozen Lake Problem:
An agent must navigate a slippery grid from start to goal without falling into holes. The agent intends to move 'Up', but there is a chance it slips 'Left' or 'Right'. Training:

  1. Initialize Q-table to 0.
  2. The agent picks an action (randomly or optimally).
  3. The agent observes the outcome state and reward.
  4. The Q-table is updated using the outcome.
  5. Repeat until the end of the episode. Over hundreds of episodes, the agent's Q-table converges, and the optimal policy naturally avoids holes and slippery edges leading to danger.

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

Why is Q-Learning used instead of standard Markov Decision Processes (MDPs) in certain environments?

Q2

In Q-Learning, what does a Q-value stored in the lookup table (Q-table) represent?

Q3

What does "Exploitation" refer to during the training of a Q-Learning agent?

Q4

When is Deep Q-Learning typically implemented?

Q5

In the Q-Learning Update Rule, what is the role of the parameter α\alpha?

Q-Learning | PROJECT ENGRAM