Define the prediction task
Specify states, actions, reward signal and episode termination so the model predicts transitions and/or rewards relevant to planning.
Model-based reinforcement learning. Assess planning and rewards.
Model-based reinforcement learning (MBRL) builds an explicit predictive model of environment dynamics or rewards, then uses planning or model-predictive control to choose actions. Key practical issues include defining the state and action spaces, modelling transition and reward functions, and evaluating planned policies under distribution shift and model bias.
Learning concept · Not a validated service
Model-based reinforcement learning (MBRL) builds an explicit predictive model of environment dynamics or rewards, then uses planning or model-predictive control to choose actions. Key practical issues include defining the state and action spaces, modelling transition and reward functions, and evaluating planned policies under distribution shift and model bias.
A proposed application: train a learned dynamics model in simulation to test safe control strategies before deploying them in physical systems. Any deployment must include safety constraints and human oversight; the supplied starter does not implement this extension.
Specify states, actions, reward signal and episode termination so the model predicts transitions and/or rewards relevant to planning.
Fit a simple dynamics or reward model (for example a probabilistic next-state regressor) on logged transitions and validate predictive error on held-out episodes.
Use the learned model for planning (MPC, trajectory optimisation or Monte‑Carlo rollouts) and compare planned policy performance to a baseline policy in simulation.
Report average reward, regret and performance variance across random seeds and stress tests for model mismatch and rare states.
The supplied starter implements a 4-armed bandit using an epsilon-greedy action selection and online sample-mean updates. It simulates binary rewards for each arm, increments counts, updates estimated reward rates with a running average, and 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 is a stationary multi-armed bandit simulation and contains no model-based RL elements: there is no state representation, no learned dynamics or reward model, and no planning or rollouts for policy selection.
Extend the baseline by collecting state–action–next-state transitions from a simulator, train a dynamics model (probabilistic or ensemble), and use model-predictive control to plan actions in simulated episodes before testing on a live system.
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.