|
14 | 14 | are correctly handled.
|
15 | 15 | (PRs :pr:`2277`, :pr:`2278`)
|
16 | 16 |
|
| 17 | + The fixed bug was subtle and only occurred for specific configurations of |
| 18 | + settings and arguments where ``do_grad=False`` was used (either explicitly |
| 19 | + by provided kwarg or implicitly through defaults). |
| 20 | + To determine if you might have been affected by it, check your code for |
| 21 | + setups like the following. |
| 22 | + |
| 23 | + .. code:: python |
| 24 | +
|
| 25 | + # Bug is backend independent. JAX is selected as an example where |
| 26 | + # do_grad=False might be selected in response to the backend's value of |
| 27 | + # pyhf.tensorlib.default_do_grad being True. |
| 28 | + pyhf.set_backend("jax", pyhf.optimize.minuit_optimizer(strategy=0)) |
| 29 | +
|
| 30 | + ... |
| 31 | +
|
| 32 | + fit_result, opt_result = pyhf.infer.mle.fit( |
| 33 | + data, model, return_result_obj=True, do_grad=False |
| 34 | + ) |
| 35 | + assert opt_result.minuit.strategy.strategy == 0 # fails for pyhf v0.7.2 |
| 36 | +
|
| 37 | + Full example that fails in ``pyhf`` ``v0.7.2``: |
| 38 | + |
| 39 | + .. code:: python |
| 40 | +
|
| 41 | + import pyhf |
| 42 | +
|
| 43 | + pyhf.set_backend("jax", pyhf.optimize.minuit_optimizer(strategy=0)) |
| 44 | +
|
| 45 | + model = pyhf.simplemodels.uncorrelated_background( |
| 46 | + signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0] |
| 47 | + ) |
| 48 | + data = [51, 48] + model.config.auxdata |
| 49 | +
|
| 50 | + # passing with strategy kwarg explicitly given |
| 51 | + fit_result, opt_result = pyhf.infer.mle.fit( |
| 52 | + data, model, return_result_obj=True, do_grad=False, strategy=0 |
| 53 | + ) |
| 54 | + minuit_strategy = opt_result.minuit.strategy.strategy |
| 55 | + print(f"# Minuit minimization strategy: {minuit_strategy}") |
| 56 | + assert minuit_strategy == 0 |
| 57 | +
|
| 58 | + # strategy kwarg not given |
| 59 | + fit_result, opt_result = pyhf.infer.mle.fit( |
| 60 | + data, model, return_result_obj=True, do_grad=False |
| 61 | + ) |
| 62 | + minuit_strategy = opt_result.minuit.strategy.strategy |
| 63 | + print(f"# Minuit minimization strategy: {minuit_strategy}") |
| 64 | + assert minuit_strategy == 0 # fails for pyhf v0.7.2 |
| 65 | +
|
17 | 66 | Contributors
|
18 | 67 | ------------
|
19 | 68 |
|
|
0 commit comments