Series: The Learn Arc โ 50 posts through the Active Inference workbench.
Previous: Part 43 โ Session ยง8.4: Continuous play
Hero line. Fitting an Active Inference model to data is not a separate topic. The parameters (precisions, preferences, transition kernels) are just another latent variable, and the same Bayesian machinery from Chapter 4 does the work.
From simulation to inference
So far every agent has been driven by fixed parameters โ we chose the precisions, the C vector, the B transitions. Chapter 9 flips the question: given a subject's observed trajectory, which parameters best explain it?
The good news is structural: once you accept that Active Inference is Bayesian all the way down, fitting is just inference at one more level. No gradient descent detour, no new algorithm โ Bayes over parameters.
Five beats
Parameters are latent variables. Promote every parameter of interest โ sensory precision, C, B โ to a random variable with a prior. Observed trajectories are then evidence for those latents.
Likelihood of a trajectory = product of per-step evidences. For each observed
(o_t, a_t)under candidate parametersฮธ, compute the agent's action likelihood given Eq 4.14 and the observation likelihood given Eq 4.13. Multiply over time.Posterior over parameters via Bayes.
p(ฮธ | data) โ p(data | ฮธ) ยท p(ฮธ). In practice: MCMC for small models, variational parameters for large ones. Either way the workbench treats the subject's trajectory as data in, posterior out.Group-level vs subject-level. Hierarchical priors let you pool information across subjects: every subject has their own
ฮธ_i, drawn from a population-level prior. This is standard computational-psychiatry machinery, reused with zero modification.Identifiability is a real risk. Some parameter combinations (precision ร preference, for example) trade off almost perfectly and cannot be disentangled from behavior alone. The session shows you how to spot this in the posterior and what to do about it.
Why it matters
This is where Active Inference meets empirical science. A pretty framework that cannot be fit to data stays in the slide deck; a framework that can be fit shows up in clinical studies, behavioral experiments, and animal models. Session 9.1 provides the bridge โ and makes clear that no new machinery is needed to cross it.
Quiz
- Why can sensory precision and preference strength trade off in the likelihood?
- What does a flat posterior over one parameter tell you about the experiment design?
- If every subject has their own
ฮธ_i, what does the group-level prior let you say that subject-level fits alone cannot?
Run it yourself
mix phx.server
# open http://localhost:4000/learn/session/9/s1_fit_to_data
Cookbook recipe: fitting/sensory-precision โ simulate a subject, then fit the sensory precision back from the observed trajectory. Watch the posterior tighten as the data length grows. Extend to two free parameters and see the banana-shaped correlation that makes identifiability non-trivial.
Next
Part 45: Session ยง9.2 โ Comparing models. Given two candidate Active Inference models for the same subject, which wins? Free-energy model comparison gives a principled answer โ and is exactly the same equation the agent uses internally, applied one level up.
Powered by The ORCHESTRATE Active Inference Learning Workbench โ Phoenix/LiveView on pure Jido.








