Repository navigation
Skip dependent Parameters in fix_all_parameters and free_all_parameters - #301
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #301 +/- ##
========================================
Coverage 98.21% 98.21%
========================================
Files 65 65
Lines 6399 6399
Branches 1082 1082
========================================
Hits 6285 6285
Misses 60 60
Partials 54 54
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Fixing or freeing all Parameters of a model raised an AttributeError when a diffusion model was attached, because the per-Q Parameters a diffusion model generates are dependent and cannot be fixed. Co-Authored-By: Claude Fable 5.2 <[email protected]>
The regression test was in test_sample_model.py and needed a diffusion model. The method under test is ModelBase.fix_all_parameters, and a parameter linked to another one with make_dependent_on reaches the bug on a plain ModelBase, so the test moves to test_model_base.py. Co-Authored-By: Claude Fable 5.2 <[email protected]>
henrikjacobsenfys
force-pushed
the
fix-all-parameters-dependent
branch
from
November 12, 2026 22:11
9cf520e to
55a1143
Compare
This was referenced Nov 12, 2026
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.
Problem
fix_all_parameters()andfree_all_parameters()raised on any model that has a dependent Parameter at some Q:Both methods set
fixedon everything fromget_all_variables(). That includes dependent Parameters, which cannot be fixed. They come from:StretchedExponential, whose width depends on its other parameters (also in aResolutionModel),make_dependent_on.Change
Both methods now loop over
get_fittable_parameters(), which is the independent Parameters only. Dependent Parameters are skipped; they follow the Parameters they depend on, and those are fixed or freed.ComponentCollectionandModelComponentalready work this way.Relation to other PRs
JointAnalysis) makes copies of a shared component dependent on each other and relies on this behaviour. It carried its own version of this fix, which it drops in favour of this PR. An independent review compared the two on 46 models and found them equivalent.Tests
One regression test in
test_model_base.py, next to the otherfix_all_parameterstests: a per-Q parameter tied to another one withmake_dependent_on. It fails ondevelop.🤖 Generated with Claude Code