Skip to content

fix: make tutorial 5 share its centre and fit its regression #73

Closed

Description

@Jammy2211

Overview

fix: make tutorial 5 share its centre and fit its regression

Part of the four linked HowToFit teaching tasks authorized on 2026-10-17. Human said "Go" after the scope discussion; EP includes the missing regression likelihood. No merge or release is authorized.

Plan

Assign the same centre prior to all dataset models. Replace the constant regression likelihood with an explicitly explained width-relation model; validate likelihood sensitivity and shared identity, run real EP and inspect updates/figures. Regenerate notebooks/catalogue. Remove the no-run entry only if real-sampling evidence supports it; retain and document any remaining blocker.

Tier: glance — merge mode: human /prm (stop at review).

Detailed implementation plan

Primary repository: HowToFit. Branch: feature/howtofit-ep-shared-centre.
Local clone: /workspace/scratch/a05dd794807b/HowToFit, main clean and fetched before work. Mind has no conflicting claim in these repositories. The two HowToFit changes are coordinated sequentially in this authorized batch on separate branches; no separate bundle backlog.

Assign the same centre prior to all dataset models. Replace the constant regression likelihood with an explicitly explained width-relation model; validate likelihood sensitivity and shared identity, run real EP and inspect updates/figures. Regenerate notebooks/catalogue. Remove the no-run entry only if real-sampling evidence supports it; retain and document any remaining blocker.

Heart door: STALE, release stale and monitoring red; not a release-readiness claim. Recheck authoritative readiness before shipping. Use Python 3.12 local runtime.

Original Prompt

Starting prompt

HowToFit tutorial 5 (EP) never shares the centre it says it shares

Type: bug
Target: HowToFit
Repos:

  • HowToFit
    Themes:
  • graphical-ep
  • tutorials
    Difficulty: small
    Autonomy: supervised
    Priority: normal
    Status: formalised
    Consequence: glance
    Witness: af.ModelPlotter(factor_graph.global_prior_model).figure() for tutorial 5 shows one shared centre (the blue shared badge), the EP state figure shows every dataset factor updating with no STALE FACTORS line, the headless run exits 0 and the notebook is regenerated.
    Review-minutes: 3
    Unattended: ready
    Filed: 2026-09-13

Found 2026-09-13 while rolling the model figure into
HowToFit/scripts/chapter_3_graphical_models/tutorial_5_expectation_propagation.py
(model-figures phase 6a, task model-figures-rollout-autofit, PyAutoFit#1620).

Symptom

The tutorial's prose says "We will assume all Gaussians share the same centre"
and creates centre_shared_prior = af.GaussianPrior(...), but never assigns it:
each per-dataset model gets a fresh af.GaussianPrior for centre, so nothing
is shared across the datasets. The new model figure makes this visible: no
shared badge appears anywhere on the map (only the orange relation pills
into linear_regression), and the EP run prints
STALE FACTORS: dataset_0 never completed a single update.

Related: the tutorial is listed in config/build/no_run.yaml as NEEDS_FIX 2026-08-05 (PyAutoFit#1454, LinearRegressionAnalysis.log_likelihood_function
returns a constant -1), so CI never runs it and neither defect is caught.

Fix

  • Assign centre_shared_prior to every per-dataset model's centre (mirror how
    tutorial 2 / tutorial 3 share the centre), so the map shows the blue shared
    badge and the EP fit actually passes messages about one centre.
  • Re-check the __Seeing the EP run__ prose added in phase 6a against a fresh
    render once the centre is shared (it was written to describe only what the
    unshared map showed).
  • If PyAutoFit#1454 is fixed alongside, drop the no_run.yaml entry so smoke CI
    runs the tutorial again; otherwise leave it and say so in the PR.

Acceptance

  • af.ModelPlotter(factor_graph.global_prior_model).figure() shows one shared
    centre; the EP state figure shows every dataset factor updating.
  • Headless run exits 0; notebook regenerated.

Activity

  1. Jammy2211 commented on Oct 23, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged in #75 (be3c7ab77). Tutorial 5 now shares the EP centre across datasets and has a real width-regression factor. Before merging, the smoke epilogue was fixed to install Nautilus (c005661); CI then passed on 3.12 and 3.13. The human approved the FWHM teaching assumption at /prm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions