scikit-hep / cabinetry

design and steer profile likelihood fits
https://cabinetry.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
26 stars 21 forks source link

feat: restore optimizer settings after fits #362

Closed alexander-held closed 2 years ago

alexander-held commented 2 years ago

When performing fits via the fit API (e.g. MLEs or pyhf.infer.hypotest via fit.limit / fit.significance), the optimizer is set to Minuit by cabinetry via pyhf.set_backend. Previously it just stayed this way, but now it instead gets set back to the initial settings (e.g. back to scipy, which is the pyhf default).

Now that the second RC for pyhf 0.7.0 is out, the integration test tolerance has to be slightly relaxed for CI to pass. Unclear why #361 is not affected by this. Locally a change in result bisects to https://github.com/scikit-hep/pyhf/pull/1919, but the difference is so small that it likely is down to floating point differences amplifying in the post-fit yield uncertainty calculation.

* restore original pyhf optimizer settings after fits (for which Minuit is used by cabinetry)
* slightly relax tolerance in integration test
codecov[bot] commented 2 years ago

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (c501013) compared to base (724e5f8). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #362 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 23 23 Lines 2001 2009 +8 Branches 326 326 ========================================= + Hits 2001 2009 +8 ``` | [Impacted Files](https://codecov.io/gh/scikit-hep/cabinetry/pull/362?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep) | Coverage Δ | | |---|---|---| | [src/cabinetry/fit/\_\_init\_\_.py](https://codecov.io/gh/scikit-hep/cabinetry/pull/362/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep#diff-c3JjL2NhYmluZXRyeS9maXQvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-hep)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.