scikit-hep / cabinetry

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

feat: minimizer configuration for fit.fit #330

Closed alexander-held closed 2 years ago

alexander-held commented 2 years ago

Adding minimizer configuration options to cabinetry.fit: strategy, maxiter and tolerance allow configuring the Minuit strategy, maximum number of iterations and tolerance for Migrad. This extends the fit API functionality, similarly to #320 and #321.

When fitting with custom_fit=True, a ValueError is now raised if the fit fails.

Since the pyhf fit API does not support strategy=None currently (see https://github.com/scikit-hep/pyhf/issues/1785), the strategy kwarg is only propagated for values other than None. This can be refactored in the future in case this changes.

The integration test changes are due to the default tolerance with custom_fit=True now matching the default when using the pyhf fit API (previously the tolerance was reduced by a factor of ten).

partially addresses #329

* added minimizer configuration options to fit.fit
* new supported keyword arguments are strategy, maxiter and tolerance
* raise ValueError when fits with custom_fit=True fail
codecov[bot] commented 2 years ago

Codecov Report

Merging #330 (840397a) into master (fa1b7a2) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #330   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         1925      1933    +8     
  Branches       310       312    +2     
=========================================
+ Hits          1925      1933    +8     
Impacted Files Coverage Δ
src/cabinetry/fit/__init__.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.