DEV Community

ORCHESTRATE
ORCHESTRATE

Posted on

Active Inference — The Learn Arc, Part 45: Session §9.2 — Comparing models

Session 9.2 — Comparing models

Series: The Learn Arc — 50 posts through the Active Inference workbench.
Previous: Part 44 — Session §9.1: Fit to data

Hero line. The agent uses free energy to arbitrate between explanations of the world. The scientist uses free energy to arbitrate between models of the agent. Same equation, one level up.


Self-similar Bayes

In Session 9.1 we fit one model's parameters. In Session 9.2 we step back and ask: is this model even the right one? The answer comes from model evidence — the marginal likelihood p(data | model) — and its free-energy approximation is literally the same object Eq 4.13 minimised, just evaluated at the model level instead of the state level.

Active Inference is self-similar this way: inference over states, inference over parameters, inference over models. All three are the same Bayes.

Five beats

  1. Model evidence integrates out the parameters. p(data | M) = ∫ p(data | θ, M) p(θ | M) dθ. Not the max likelihood — the average over the prior. That integral is the currency of model comparison.

  2. Variational free energy bounds it. We already have F for the fitted model. -F ≈ log p(data | M) up to a KL gap. Lower F → more evidence. No new math, just one more level of the hierarchy.

  3. Bayes factors from F differences. log BF_12 = F_2 − F_1. A difference of 3 in log units is "strong evidence." A difference of 5 is "very strong." The workbench prints these directly after a fit.

  4. Complexity penalty is built in. Free energy decomposes into accuracy minus complexity. A model that over-fits pays a complexity cost automatically. No separate AIC, no cross-validation — the penalty falls out of the same equation.

  5. Family-level comparison for structure. Group models into families ("with hierarchy" vs "without hierarchy," "learning A" vs "fixed A") and sum evidences within a family. Lets you answer structural questions about the subject without picking a single winning parameter setting.

Why it matters

Without model comparison, Active Inference fitting is just a very elaborate way to draw posteriors. Model comparison turns it into science: "this subject's behavior is better explained by hierarchical planning than by flat planning, Bayes factor 47." Session 9.2 is where the framework earns its place in a methods section.

Quiz

  • Why is model evidence the marginal likelihood, not the max likelihood?
  • How does free energy's complexity term penalise over-parameterised models without any explicit penalty coefficient?
  • A Bayes factor of 1 means what, and how should you report it?

Run it yourself

mix phx.server
# open http://localhost:4000/learn/session/9/s2_comparing_models
Enter fullscreen mode Exit fullscreen mode

Cookbook recipe: fitting/model-comparison — fits two candidate models (one-layer vs two-layer) on the same simulated trajectory and prints F_1, F_2, and the Bayes factor. Swap the generator between models to confirm the comparison recovers the true one.

Next

Part 46: Session §9.3 — Case study. One subject, one dataset, two candidate models, one posterior, one Bayes factor. A self-contained worked example that turns the methodology from abstract to concrete. Chapter 9 in miniature.


Powered by The ORCHESTRATE Active Inference Learning Workbench — Phoenix/LiveView on pure Jido.

Top comments (0)