pyhf icon indicating copy to clipboard operation
pyhf copied to clipboard

toms748 doesn't respect POI bounds in the model

Open kratsg opened this issue 2 years ago • 1 comments

Summary

See the lines here:

https://github.com/scikit-hep/pyhf/blob/09371dac3615924ecd0af98a6890f1c3711ad4d1/src/pyhf/infer/intervals/upper_limits.py#L115-L126

Particularly, if the CLs isn't bracketed by the upper/lower bounds, one should not extend the bracket beyond what the bounds are in the model, otherwise you get a ValueError caught inside infer like so

  File "/Users/kratsg/.pyenv/versions/pyhf-dev/lib/python3.8/site-packages/pyhf/infer/mle.py", line 122, in fit
    _validate_fit_inputs(init_pars, par_bounds, fixed_params)
  File "/Users/kratsg/.pyenv/versions/pyhf-dev/lib/python3.8/site-packages/pyhf/infer/mle.py", line 59, in _validate_fit_inputs
    raise ValueError(
ValueError: fit initialization parameter (index: 82, value: 10) lies outside of its bounds: [0, 5]
To correct this adjust the initialization parameter values in the model spec or those given
as arguments to pyhf.infer.fit. If this value is intended, adjust the range of the parameter
bounds.

OS / Environment

$ system_profiler -detailLevel mini SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 13.0.1 (22A400)
      Kernel Version: Darwin 22.1.0
      Time since boot: 9 days, 5 hours, 14 minutes

Steps to Reproduce



File Upload (optional)

No response

Expected Results

I expected it to crash earlier or extend the bounds for me.

Actual Results

See above.

pyhf Version

$ pyhf --version
pyhf, version 0.7.2

Code of Conduct

  • [X] I agree to follow the Code of Conduct

kratsg avatar Jun 06 '23 20:06 kratsg

Ok, figured out that there's a portion of the code here that doesn't use the par_bounds provided by the user when running upper_limits(... scan=None): https://github.com/scikit-hep/pyhf/blob/bd8c21a33b2f3ce8b41ea78cb351eef91c21b92b/src/pyhf/infer/intervals/upper_limits.py#L255-L258

kratsg avatar Aug 07 '23 22:08 kratsg