Define the MDP
Choose a small, observable state space and an episodic or continuing transition model (for example a random-walk chain) and implement it via Gymnasium or a simple simulator.
Estimate value with TD learning. Evaluate action preferences.
Temporal-difference (TD) learning bootstraps value estimates using successive predictions rather than waiting for episode returns. Key practical issues include defining the MDP (states, transitions, rewards), choosing a step-size and bootstrapping parameter, and monitoring mean-squared value error and stability across seeds.
Learning concept · Not a validated service
Temporal-difference (TD) learning bootstraps value estimates using successive predictions rather than waiting for episode returns. Key practical issues include defining the MDP (states, transitions, rewards), choosing a step-size and bootstrapping parameter, and monitoring mean-squared value error and stability across seeds.
A proposed use: run TD(0) policy evaluation on a small simulated MDP (for example, the random-walk chain) to compare step-size sensitivity and bootstrap bias. This extension is not provided by the supplied starter.
Choose a small, observable state space and an episodic or continuing transition model (for example a random-walk chain) and implement it via Gymnasium or a simple simulator.
Write a value-function update that bootstraps: V(s) <- V(s) + alpha * (r + gamma*V(s') - V(s)), using on-policy transitions collected from a behaviour policy.
Track mean-squared value error (MSVE) against a reference solution, plot learning curves across random seeds and sweep step-sizes and gamma to check stability.
Produce visualisations of value estimates over the state space, per-episode return traces, and examples of failure modes such as divergence or slow mixing.
The supplied starter simulates a 4-armed bandit with epsilon-greedy action selection and updates sample-average estimates for each arm (estimated_values) using a running average: estimated_values[a] += (reward - estimated_values[a]) / action_counts[a]. It prints action counts, estimated rates and total reward.
for step in range(1, 2001):
if rng.random() < epsilon:
action = rng.integers(len(true_reward_rates))
else:
action = int(np.argmax(estimated_values))
reward = 1 if rng.random() < true_reward_rates[action] else 0
action_counts[action] += 1
total_reward += reward
estimated_values[action] += (reward - estimated_values[action]) / action_counts[action]The code implements a stationary multi-armed bandit with sample-average updates, not temporal-difference learning on a Markov decision process. It has no states, no state transitions, no bootstrapped TD update (r + gamma * V(s')), and no episodic environment or Gymnasium integration.
Proposed extension: implement TD(0) to evaluate a fixed policy on a small MDP (for example a 5-state random-walk). Compare learning curves for different step-sizes and report mean-squared value error against the true value function.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.