fix: AnalysisImaging.log_likelihood_function CPU branch returns figure_of_merit (not log_likelihood)#504
Merged
Conversation
…ging.log_likelihood_function The CPU branch returned fit.log_likelihood while the JAX branch returned fit.figure_of_merit. For pixelization (inversion) fits these differ by the regularization log-det terms, so any nested sampler driven by the CPU path optimised a chi^2-only target and drifted toward outer_coefficient ~ 0 (noise-overfit), while JAX runs converged to the physical Bayesian-evidence maximum. Add a regression test that exercises a Rectangular Pixelization with Constant regularization so the two quantities differ; the existing parametric-Sersic test still passes because fom == log_likelihood when there is no inversion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AnalysisImaging.log_likelihood_functionreturnedfit.log_likelihoodwhile the JAX branch returnedfit.figure_of_merit. For pixelization (inversion) fits these differ by the regularization log-det terms of the Bayesian log evidence.outer_coefficient ≈ 0(noise-overfit, degenerate "no regularization" mode). JAX runs of the same model converged to the physical Bayesian-evidence maximum.fit.figure_of_meritfrom both branches. For purely parametric fits this is a no-op becausefigure_of_merit == log_likelihood; for inversion fits the search now uses the mathematically correct objective.Test plan
test__log_likelihood_function__returns_figure_of_merit_for_pixelizationexercises a Rectangular Pixelization with Constant regularization, assertsanalysis.log_likelihood_function(instance) == fit.figure_of_merit, and verifies the two quantities genuinely differ (so the test isn't a tautology).test__figure_of_merit__matches_correct_fit_given_galaxy_profiles(parametric Sersic) still passes becausefigure_of_merit == log_likelihoodwhen there's no inversion.test_autolens/imaging/model/test_analysis_imaging.pypasses (5/5).Impact
figure_of_merit.figure_of_merit == log_likelihoodfor those.🤖 Generated with Claude Code