Lecture 18: Continuous State MDPs and Model Simulation
Stanford CS229 lecture 18 notes: Continuous State MDPs and Model Simulation.
- cs229
- machine-learning
- course-notes
On this page
The problem with continuous states#
Real systems have continuous states. A car has position and velocity, and a helicopter has position, orientation (3 angles), and velocities, which is a 12 dimensional continuous state. We can't keep a table with one value per state.
Option 1: Discretization#
Chop the continuous space into a grid, and treat each cell as a discrete state.
It works for 1 or 2 dimensions. But it has two big problems:
- Piecewise constant representation: the value function is flat within each cell, so you need very fine grids for smooth functions.
- Curse of dimensionality: if each dimension has values, then an -dimensional state has cells. With and , that's states. With 12 dimensions, it's hopeless.
Discretization is fine for problems up to around 4D, and sometimes up to 6D with care.
Option 2: Fitted Value Iteration#
Approximate the value function with a parametric function, such as a linear function of some features:
where is a feature vector (e.g., ).
Needing a model#
To compute the value iteration update, we need to compute an expectation over next states. We usually don't have a closed form, so we need a simulator (model) that, given , produces a next state .
The algorithm#
Sample states at random. Then repeat:
For each sample state and each action :
- Sample next states from the simulator.
- Compute .
Set the target: .
Then fit with linear regression, so that :
So fitted value iteration is just value iteration, where the "assignment" step is replaced by a regression. It's not guaranteed to converge in general, but works well in practice.
Where does the simulator come from?#
Physics-based simulators#
Built from the equations of motion. Used in robotics, games, etc.
Learning a model from data#
Have a human (or a random policy) control the system, record the transitions , and fit a model. A simple choice is a linear model:
fit by least squares:
You can add features to make it non-linear, like using as inputs.
Making it stochastic#
Real systems are noisy, so we add noise: , with . This is a stochastic simulator, and it lets the algorithm account for uncertainty.