Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.
Examine the components of an intelligent agent: the policy, the value function, and the internal environment model.
| Symbol / Term | Meaning | Beginner Interpretation |
|---|---|---|
| Value of state s | Desirability of being in state s | |
| Expected value under policy pi | Average outcome over stochastic runs |
State near the goal has high expected value V=9.2; state trapped in a maze corner has low value V=0.1.
Result: Agent prefers states with higher V(s)
Evaluate current state s using value function V(s) or Q(s,a).
Sample action from stochastic policy or pick argmax of Q-values.
Collect transition tuple (s, a, r, s') into memory buffer.
Problem: Mastering games like Chess, Go, and Atari without ever being given the rules of the game.
Solution: MuZero learns its own latent internal model of the environment dynamics.
Interactive activity component
Calculate and compare state values for a simple 3-state chain.
For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:
!pip install numpy1 import numpy as np
import numpy as np β NumPy math
1 # 3 States: [Start (0), Step (1), Goal (2)] 2 # Reward +10 only upon reaching Goal 3 gamma = 0.9 # Discount factor 4 5 # Value of Goal (Terminal state) is 0 6 V_goal = 0.0 7 # Value of Step: immediate reward 10 to reach Goal 8 V_step = 10.0 + gamma * V_goal 9 # Value of Start: immediate reward 0 to reach Step 10 V_start = 0.0 + gamma * V_step 11 12 print(f"Value of Start State V(0): {V_start:.1f}") 13 print(f"Value of Step State V(1): {V_step:.1f}")
# 3 States: [Start (0), Step (1), Goal (2)]
Environment setup
# Reward +10 only upon reaching Goal
Reward vector
gamma = 0.9 # Discount factor
Discount parameter
# Value of Goal (Terminal state) is 0
Terminal
V_goal = 0.0
V[2] = 0
# Value of Step: immediate reward 10 to reach Goal
Step state
V_step = 10.0 + gamma * V_goal
V[1] = 10 + 0.9 * 0 = 10.0
# Value of Start: immediate reward 0 to reach Step
Start state
V_start = 0.0 + gamma * V_step
V[0] = 0 + 0.9 * 10 = 9.0
print(f"Value of Start State V(0): {V_start:.1f}")
Display V(0)
print(f"Value of Step State V(1): {V_step:.1f}")
Display V(1)
Click "Copy for Colab", open Google Colab, paste into a single cell, and run.
1 # ========================================================= 2 # Evaluating State Values in Python 3 # Prepared for Google Colab (Run with Shift + Enter) 4 # ========================================================= 5 6 # Step 1: Install required packages 7 !pip install numpy 8 9 # Step 2: Import libraries 10 import numpy as np 11 12 # Step 3: Run Demonstration 13 # 3 States: [Start (0), Step (1), Goal (2)] 14 # Reward +10 only upon reaching Goal 15 gamma = 0.9 # Discount factor 16 17 # Value of Goal (Terminal state) is 0 18 V_goal = 0.0 19 # Value of Step: immediate reward 10 to reach Goal 20 V_step = 10.0 + gamma * V_goal 21 # Value of Start: immediate reward 0 to reach Step 22 V_start = 0.0 + gamma * V_step 23 24 print(f"Value of Start State V(0): {V_start:.1f}") 25 print(f"Value of Step State V(1): {V_step:.1f}")
Calculates future returns backwards: V(1)=10.0, V(0)=9.0.
Agent naturally seeks states with higher values: 0 -> 1 -> Goal.
3-state chain with reward at goal
Value of Start State V(0): 9.0 Value of Step State V(1): 10.0
The discounted value function creates an uphill gradient toward the goal that the agent can climb.
Q-learning, Q-table updates, DQN architectures, and exploration-exploitation trade-offs.
Test your understanding with these questions. Remember, this is for learning, not examination!