pyhf v0.7.3 released

5 views
Skip to first unread message

pyhf announcements

unread,
Aug 17, 2023, 4:03:39 PM8/17/23
to pyhf announcements
Dear pyhf users,

We're happy to announce that pyhf v0.7.3 is out now on PyPI and Conda-forge! This is a patch release with fixes contributed by Alexander Held and Daniel Werner. There are no API changes and no changes in dependency lower bounds, so we encourage you to update to v0.7.3

```
python -m pip install --upgrade pyhf
```

Below we list the most important points from the release notes:

* Guard pyhf.optimize.opt_minuit.minuit_optimizer optimizer strategy from None to ensure iminuit.Minuit.strategy strategies are correctly handled.

  The fixed bug was subtle and only occurred for specific configurations of settings and arguments where do_grad=False was used (either explicitly by provided kwarg or implicitly through defaults). To determine if you might have been affected by it, check your code for setups like the following.

```
# Bug is backend independent. JAX is selected as an example where
# do_grad=False might be selected in response to the backend's value of
# pyhf.tensorlib.default_do_grad being True.
pyhf.set_backend("jax", pyhf.optimize.minuit_optimizer(strategy=0))

...

fit_result, opt_result = pyhf.infer.mle.fit(
    data, model, return_result_obj=True, do_grad=False
)
assert opt_result.minuit.strategy.strategy == 0  # fails for pyhf v0.7.2
```

Full example that fails in `pyhf` `v0.7.2`:

```
import pyhf

pyhf.set_backend("jax", pyhf.optimize.minuit_optimizer(strategy=0))

model = pyhf.simplemodels.uncorrelated_background(
    signal=[12.0, 11.0], bkg=[50.0, 52.0], bkg_uncertainty=[3.0, 7.0]
)
data = [51, 48] + model.config.auxdata

# passing with strategy kwarg explicitly given
fit_result, opt_result = pyhf.infer.mle.fit(
    data, model, return_result_obj=True, do_grad=False, strategy=0
)
minuit_strategy = opt_result.minuit.strategy.strategy
print(f"# Minuit minimization strategy: {minuit_strategy}")
assert minuit_strategy == 0

# strategy kwarg not given
fit_result, opt_result = pyhf.infer.mle.fit(
    data, model, return_result_obj=True, do_grad=False
)
minuit_strategy = opt_result.minuit.strategy.strategy
print(f"# Minuit minimization strategy: {minuit_strategy}")
assert minuit_strategy == 0  # fails for pyhf v0.7.2
```

Thank you for using pyhf and for continuing to provide us feedback on both new feature requests as well as sharing your bug reports and user experiences through the recommended channels.

Best,
The pyhf dev team (Matthew, Lukas, and Giordon)
Reply all
Reply to author
Forward
0 new messages