-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Optimization terminated successfully." when HESSE fails after MIGRAD #1928
Comments
Hi @alexander-held! Would something like this work here?
|
I assume that would work, but we might need one of the core developers to comment on how exactly the |
Not sure what you want from the logic. When |
One thing that could be done is to raise separate exceptions for hesse and migrad, eg |
Related to what @kratsg was saying, looking at pyhf/src/pyhf/optimize/opt_minuit.py Lines 136 to 138 in 1191f66
this final if minimizer.valid:
# Extra call to hesse() after migrad() is always needed for good error estimates.
# If you pass a user-provided gradient to MINUIT, convergence is faster.
minimizer.hesse()
if not minimizer.valid:
message = "Optimization failed."
fmin = minimizer.fmin
if not fmin.has_made_posdef_covar:
message += (
" Failed to make the covariance matrix positive definite."
) given how HESSE works, it would probably be better to try to go spend time working with Hans to figure out how to deal with scikit-hep/iminuit#746 more appropriately. |
In this implementation, wouldn't it make more sens to use |
That's probably fine, but my point is more that this is trying to handle something that is out of scope for |
I think some of this can be done in pyhf/src/pyhf/optimize/opt_minuit.py Lines 123 to 130 in 2cd8c0b
below the Hesse section pyhf/src/pyhf/optimize/opt_minuit.py Lines 135 to 140 in 2cd8c0b
and (possibly) before Hesse only add something about Migrad to the message? |
This is what I was trying to do with my code. However, I am a bit sceptical about the message "Optimisation terminated successfully" in thee first place, as this will probably only appear whenever |
Summary
When HESSE fails after MIGRAD with the
minuit
backend, the resulting error is accompanied by a misleading "Optimization terminated successfully." message. This happens since the status is queried before HESSE is run (which can turn a valid into an invalid minimum, related: scikit-hep/iminuit#746):pyhf/src/pyhf/optimize/opt_minuit.py
Lines 123 to 125 in 2cd8c0b
OS / Environment
n/a
Steps to Reproduce
This uses a workspace from https://www.hepdata.net/record/resource/2258588?landing_page=True.
curl -OJLH "Accept: application/x-tar" https://doi.org/10.17182/hepdata.100351.v2/r1 tar -xvf likelihood_ttbarZ_13TeV.tar.xz pyhf fit likelihood_ttbarZ_13TeV/3L_workspace.json --optimizer minuit
File Upload (optional)
No response
Expected Results
The error message should reflect that HESSE failed.
Actual Results
pyhf Version
pyhf, version 0.7.0rc2.dev3
Code of Conduct
The text was updated successfully, but these errors were encountered: