fit ops qol#140
Merged
Merged
Conversation
New CLI controls --minimizerMaxiter / --minimizerGtol / --minimizerFtol
forwarded to scipy.optimize.minimize as options={...}; unset values keep
the historical tol=0.0 behavior.
Timing instrumentation at debug verbosity: per-iteration dt/elapsed in
FitterCallback and [timing] lines around minimize(), _profile_beta(),
and the Hessian-free EDM/CG postfit step.
Two --externalPostfit fixes: (1) an Asimov dataset (-t -1) now loads
the external postfit values before computing the expected yield, so the
Asimov is generated at the postfit point rather than silently at
prefit; (2) the postfit covariance is recomputed at the loaded postfit
point when a Hessian is wanted (no --noHessian), enabling the two-pass
covariance recipe with --externalPostfit --noFit. The --noEDM help text
is updated to describe what is actually skipped.
rabbit_print_pulls_and_constraints.py gains --noPrefit to suppress the
prefit pull/constraint columns; the header separator now matches the
actual header width.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per review on WMass#133: drop the unnecessary try/except and the incorrect L-BFGS label (the callback counts iterations of whichever minimizer method is in use). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per review on WMass#133 ('or not args.noHessian' should be removed): with --externalPostfit --noFit the covariance is taken from the loaded fitresult again, as before. The recompute also failed with a non-positive-definite Hessian on the test tensor's Asimov workflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reconciles the review discussion on WMass#133 (rabbit_fit.py:603): when --externalPostfit provides a covariance it is used as before; when it does not (the fitresult was produced with --noHessian), the Hessian is recomputed at the loaded postfit point instead of silently writing no covariance. This enables the two-pass recipe for models whose full Hessian is infeasible during the fit: pass 1 fits with --noHessian, pass 2 reruns with --externalPostfit ... --noFit (without --noHessian) to obtain the covariance. Verified on the test tensor that the two-pass covariance is identical to the single-pass one, and that a fitresult with a covariance is still consumed without recomputation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
parms_variances now defaults to a NaN-filled vector instead of None, so the parms hist is always written with Weight storage and entries whose uncertainty was not computed (e.g. --noHessian with --noEDM) read NaN from .variances() downstream, instead of a silently absent or plausible-looking value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5a251e0 to
b209900
Compare
Collaborator
|
I still don't agree that the asimov should be done with the |
Build the Asimov dataset at the prefit point regardless of --externalPostfit, as before. The change had made `-t -1 --externalPostfit X` generate the Asimov at the loaded postfit point, but that breaks the intended use cases: - Two-pass covariance recipe (minimize, then Hessian via --externalPostfit ... --noFit): step 2 must rebuild the same likelihood step 1 minimized. A one-step Asimov fit holds nobs fixed at the prefit expectation while the parameters minimize, so a faithful split must use the prefit Asimov in step 2. Regenerating it at the postfit point yields a different likelihood whose minimum is no longer the loaded point (EDM != 0 once regularization/priors move the postfit off prefit), giving the wrong covariance. - Blinding operates on the real-data fit (-t 0); Asimov fits are never blinded, so this path is irrelevant there. --externalPostfit still loads the postfit for the postfit step via the in-fit() load. A genuine postfit-Asimov (expected sensitivity at the data-driven point) is a separate use case that should be an explicit opt-in flag, not silent default behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Thanks @davidwalter2. The idea originally was to be able to get the expected sensitivity at the data-driven point. I don't think this is currently supported. For now, I've reverted, as indeed for a full Asimov fit, you are correct (i.e. one must use the prefit Asimov even with --externalPrefit is used). |
lucalavezzo
added a commit
to lucalavezzo/rabbit
that referenced
this pull request
Jun 23, 2026
Integrates the merged sibling PRs into the priors/unification branch: WMass#140 fit-ops (minimizer flags, externalPostfit), WMass#142 scalePoiScan, WMass#143 CompositeParamModel layout fix, WMass#144 blinding groups. Conflicts (both trivial): - fitter.py: blinding_group=options.blindingGroup (main's direct form; the SimpleNamespace test fixtures already carry blindingGroup=[]). - helpers.py: kept main's cleaned-up version (dropped the explanatory comment removed on main). Also dropped tests/test_composite_param_model.py, which the merge re-introduced from this branch but was deliberately removed on main. Validated: lint clean; pytest (15) + the five CI script-tests pass; the ParamModel-prior closure is unchanged (gaussian sig_prior 1.105769e-02, asym (-1.097e-2,+1.114e-2)); parsing.py is identical to main so all of WMass#140/WMass#142/WMass#144's CLAs are present. Co-Authored-By: Claude Fable 5 <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.
--minimizerMaxiter,--minimizerGtol,--minimizerFtol--externalPostfitcovariance handling: when the external fitresult has no covariance (e.g. produced with--noHessian), recompute the Hessian at the loaded postfit point — enabling the two-pass recipe (fit with--noHessian, then--externalPostfit … --noFitto get the covariance)