Skip to content

chore: park tutorial_5_expectation_propagation as NEEDS_FIX - #44

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/ep-nan-likelihood-bug-ugkj79
Aug 5, 2026
Merged

chore: park tutorial_5_expectation_propagation as NEEDS_FIX#44
Jammy2211 merged 1 commit into
mainfrom
claude/ep-nan-likelihood-bug-ugkj79

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

tutorial_5_expectation_propagation.py cannot run at real sampling, and has not been able to for as long as the current code has been there.

class LinearRegressionAnalysis(af.Analysis):
    def log_likelihood_function(self, instance, xp=np):
        return -1

A constant likelihood that ignores instance, so every initial sample drawn for that factor has an identical figure of merit and its per-factor search cannot initialise. At real sampling the linear_regression factor never completes a single update.

It passes CI today only because HowToFit runs at PYAUTO_TEST_MODE=2, which bypasses the sampler and therefore the initializer entirely. So the gate is green on a script that fails the first thing a reader does with it — run the tutorial.

Why parked rather than fixed

A real fix needs a likelihood for the m/c regression over fwhm_list — which is computed immediately above the class and then never used by anything. The tutorial gives no indication what that regression is meant to be against, and there is no prose around the stub. Writing one means authoring teaching content and inventing x-values and a noise model, not repairing a defect, so it wants a decision rather than a guess.

Why NEEDS_FIX rather than a plain skip

Per the convention documented at the top of no_run.yaml: NEEDS_FIX entries are a to-do list, surfaced with a warning banner on every mega-run, not permanent exclusions. Verified with autohands/slow_skip_check.py, which reports it with the full reason and the date; should_skip matches only this script (tutorial_optional_hierarchical_ep and tutorial_4_hierachical_models are unaffected), and the YAML parses.

How it surfaced

PyAutoFit#1454 (merged). Before it, this failed with a raw InitializerException whose text blamed nan likelihoods — a cause that check cannot detect. After it, the run completes and emits a STALE FACTORS warning naming linear_regression, which is what made the actual bug findable.


Generated by Claude Code

`LinearRegressionAnalysis.log_likelihood_function` returns a constant `-1` and
ignores `instance`, so every initial sample drawn for that factor has an
identical figure of merit and its per-factor search cannot initialise. At real
sampling the `linear_regression` factor never completes a single update.

The tutorial "passes" CI today only because HowToFit runs at
`PYAUTO_TEST_MODE=2`, which bypasses the sampler and therefore the initializer
— so the breakage is invisible to the gate while being the first thing a reader
running the tutorial for real would hit.

Parked rather than fixed: a real fix needs a likelihood for the m/c regression
over `fwhm_list` (computed just above the class and then never used), which is
tutorial authoring rather than a mechanical repair, and the tutorial gives no
indication what the regression is meant to be against.

NEEDS_FIX rather than a plain skip, so every mega-run surfaces it instead of it
becoming a permanent silent exclusion. Surfaced by PyAutoFit#1454, which made
the failure legible by naming the stale factor instead of dying on a raw
InitializerException.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GSBb1i58cNhTx64yxBGPfs
@Jammy2211
Jammy2211 merged commit 18930ba into main Aug 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants