liveBook · Manning

Prediction step

As explained in Grokking Bayes

A prediction step propagates an estimated current state through a transition model to obtain a forecast for the next state before its new observation.

A prediction step forecasts the next hidden state before its new measurement arrives. It carries the current filtered belief through a state transition model, answering: “What do we expect next?” section 9.3

A prediction step follows this pattern:

  • Start with the current state estimate and its uncertainty. section 9.3
  • Apply the state transition model to forecast the next latent state. section 9.15
  • Add transition noise to represent increasing uncertainty during propagation. section 9.8
  • Predict the next observation, then let the update step correct the forecast when new data arrive. section 9.3

A noisy random walk

Suppose a hidden quantity changes by adding known random noise. Its predicted mean stays equal to the current mean, while its predicted variance becomes the current variance plus the transition-noise variance. The next observation adds observational noise to that variance. In a Gaussian model, these calculations remain closed form. section 9.8

for i in range(1, n):
    next_x_mean = x_mean[i - 1]
    next_x_var = x_var[i - 1] + S

This NumPy loop implements the random-walk prediction by carrying forward the previous mean and adding transition noise to its variance. section 9.8

    y_mean[i] = next_x_mean
    y_var[i] = next_x_var + R

These lines turn the predicted hidden-state distribution into a predictive distribution for the next observation by adding observation noise. section 9.8

How Grokking Bayes covers it

How deep it goes
Explains state propagation and Gaussian mean-variance calculations, then leaves measurement correction to the update step.
Examples
Uses CO₂ forecasting, Gaussian random walks, predictive variances, and a NumPy predict-update loop.
What it assumes
Assumes filtered beliefs, transition and observation models, Gaussian distributions, and basic time-step notation.
What you can do after
Apply it via NumPy by propagating Gaussian state means and variances through a random-walk transition model.
How it connects
Connects state-space models, transition models, observation models, filtering, update steps, and Kalman filters.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Bayes. The section links point to the parts of the book it draws on.