You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in pyhf's codebase (since ~forever) where the init_par for a fixed parameter might differ from the constrained value set for that fixed parameter. See for example v0.4.4:
I would've thought the underlying optimizers (particularly scipy) would be smart enough to handle or recognize when the constraint/init_pars are at odds with each other.
Actual Behavior
See description.
Steps to Reproduce
Follow along with me:
call fixed_poi_fit with:
poi_val = 0.5
data
pdf
init_pars=[1, 1, 1]
This will call opt.minimize with:
objective=twice_nll
data=data
pdf=pdf
init_pars=[1, 1, 1]
fixed_vals=[(0, 0.5)]
at this point, opt.minimize (in the case of scipy) will do
but still calls scipy.optimize.minimize with init_pars=[1, 1, 1]. If one changes this to [0.5, 1, 1] -- one observes a slightly different result... but probably more correct.
which updates the initval with the fixed value initvals['p{}'.format(index)] = value.
I was worried that the major refactor I did #951 broke this or changed this. In fact, I managed to keep the same bug in scipy, and did not introduce this bug into minuit.
The text was updated successfully, but these errors were encountered:
Description
Related: #1051 (found as part of this PR).
There is a bug in
pyhf
's codebase (since ~forever) where theinit_par
for a fixed parameter might differ from the constrained value set for that fixed parameter. See for example v0.4.4:pyhf/src/pyhf/infer/mle.py
Lines 52 to 90 in 6ac0f62
pyhf/src/pyhf/optimize/opt_scipy.py
Lines 16 to 53 in 6ac0f62
Expected Behavior
I would've thought the underlying optimizers (particularly scipy) would be smart enough to handle or recognize when the constraint/init_pars are at odds with each other.
Actual Behavior
See description.
Steps to Reproduce
Follow along with me:
call
fixed_poi_fit
with:poi_val = 0.5
data
pdf
init_pars=[1, 1, 1]
This will call
opt.minimize
with:objective=twice_nll
data=data
pdf=pdf
init_pars=[1, 1, 1]
fixed_vals=[(0, 0.5)]
at this point,
opt.minimize
(in the case of scipy) will dowhich becomes essentially
but still calls
scipy.optimize.minimize
withinit_pars=[1, 1, 1]
. If one changes this to[0.5, 1, 1]
-- one observes a slightly different result... but probably more correct.Minuit does not have the same bug here because of
pyhf/src/pyhf/optimize/opt_minuit.py
Line 45 in 6ac0f62
initvals['p{}'.format(index)] = value
.I was worried that the major refactor I did #951 broke this or changed this. In fact, I managed to keep the same bug in scipy, and did not introduce this bug into minuit.
The text was updated successfully, but these errors were encountered: