-
Notifications
You must be signed in to change notification settings - Fork 84
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
Improve error messages/hints when "Estimated distance to minimum too large." #2529
Comments
Here's an example where one runs into this issue.
This could maybe be improved with something like a better set of inits(?) but to first order, a more helpful or instructive error message would be nice. |
See #2352. |
Continuing on this thread -- ran with this code using the import pyhf
import json
import numpy as np
pyhf.set_backend("jax", pyhf.optimize.minuit_optimizer(verbose=0))
model = pyhf.simplemodels.correlated_background([1], [16.69251820997423], [17.87039285108563], [15.514643568862834])
data = [17.352095513005104] + model.config.auxdata
n_samples = 3000
mu_low = 2
mu_high = 17
steps = (mu_high-mu_low)+1
mu_tests = pyhf.tensorlib.astensor(np.linspace(mu_low, mu_high, steps))
bounds = [(-10.0, 10.0), (0, 10)]
obs_limit, exp_limit_and_bands, (poi_tests, tests) = pyhf.infer.intervals.upper_limits.upper_limit(data, model, scan=mu_tests, level=0.05, return_results=True, calctype="toybased", ntoys=n_samples, skip_failing_toys=True, par_bounds=bounds) I added some lines of code to print out the failing parameters for various pyhf/src/pyhf/infer/calculators.py Lines 798 to 835 in 89a5e54
signal failed for: [20. -0.12619636]
background failed for: [14. -2.43142359]
background failed for: [13. -3.19383645]
It's very much not clear if the problem ends up being that when we throw toys, we run into some ./cc @mhance |
Summary
When running fits, such as when doing toys, for example, one might run into a stack trace like so:
Certainly (and discussing with @alexander-held offline), the underlying issue which is a bit hard to parse is likely from this portion:
where the parameter of interest$\mu \in [0,100]$ but we have the uncertainty such that $\hat{\mu} = 4 \pm 94.68$ . Now, in this case, the Hessian is not used, so whatever comes during Migrad to calculate the uncertainty is what we rely on. It's not necessarily clear exactly how it fails, but the likely culprit is that we are just too close to the bounds to estimate the uncertainty correctly.
There is a nice presentation from @alexander-held on improving the$\tilde{q}_\mu$ definition which could definitely be considered (https://indico.cern.ch/event/1336439/contributions/5629384/attachments/2734750/4755122/20231016_qmutilde.pdf).
However, regardless of this, we might as well provide some parsing since we know estimated distance is too large, to try and determine which of the parameters is having issues with error estimation at the end of the day, to give a better hint automatically.
Additional Information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: