Skip to content
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

feat: explicitly set post-fit parameter errors to 0 for fixed parameters #346

Merged
merged 2 commits into from
Jul 29, 2022

Conversation

alexander-held
Copy link
Member

@alexander-held alexander-held commented Jul 29, 2022

Starting from iminuit version v2.12.2, running MIGRAD will set non-zero step sizes for all parameters (including fixed parameters) and does no longer just carry through the value of 0.0 that cabinetry sets for them before minimization. See scikit-hep/iminuit#762 for details. To keep post-fit parameter uncertainties for fixed parameters at zero, this now sets the relevant values to 0.0 after minimization. As there is no longer any benefit to setting the value to zero before the fit, the initial step size settings are removed.

* explicitly set post-fit parameter errors to 0 for fixed parameters for compatibility with iminuit>=2.12.1

@codecov
Copy link

codecov bot commented Jul 29, 2022

Codecov Report

Merging #346 (6eb239d) into master (00ffff5) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #346   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         1878      1876    -2     
  Branches       299       298    -1     
=========================================
- Hits          1878      1876    -2     
Impacted Files Coverage Δ
src/cabinetry/fit/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00ffff5...6eb239d. Read the comment docs.

@alexander-held alexander-held merged commit b1a12dc into master Jul 29, 2022
@alexander-held alexander-held deleted the feat/fixed-param-errors branch July 29, 2022 16:42
@alexander-held
Copy link
Member Author

For posteriority: the commit message said iminuit>=2.12.1 but should have said iminuit>=2.12.2.

kratsg pushed a commit to scikit-hep/pyhf that referenced this pull request Aug 9, 2022
* Manually set the uncertainties for fixed parameters to zero after minimization,
and remove setting the uncertainty/step_sizes during minimization, to avoid warnings
from iminuit. For iminuit v2.12.2+ "assigning zero to errors is invalid, but in the
past this was not caught." This approach harmonizes with cabinetry for fixed
parameters for iminuit v2.12.2+.
   - c.f. scikit-hep/iminuit#762
   - c.f. scikit-hep/cabinetry#346
   - c.f. https://iminuit.readthedocs.io/en/stable/changelog.html#july-15-2022
     > fix a bug in error heuristic when parameters have negative values and prevent
     > assigning negative values to errors
* Remove tests/test_optim.py test_step_sizes_fixed_parameters_minuit as the
uncertainties/step sizes values are no longer set during minimization and so are no
longer in pyhf's control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant