Replies: 1 comment 1 reply
-
Nice summary!! Just a comment:
this is correct, but in my PR it's mainly because of my usage of single precision. With double precision there's no difference anymore. Sorry for the confusion here! Another aspect to consider: I expect an overhead from these transformation that may be noticeable in runtime. Trigonometric functions (that are used by Minuit for the transformation if 2-sided bounds are present) are expensive, and I think(?) they are called per bounded parameter and per update step twice (external -> internal and back), so a few thousand times typically. I'm not sure why pyhf enforces 2-sided bounds, maybe because one can't sample a free-floating parameter without bounds from a Uniform distribution? But it might be worth to investigate if that requirement could be removed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
During the development of alternative model uncertainty compute methods in
cabinetry
(see scikit-hep/cabinetry#221 and scikit-hep/cabinetry#535), we ran into some interesting behaviour due toMINUIT
handling of parameters with bounds.The external variables (exposed to user) corresponding to bound parameters in
MINUIT
undergo a transformation to be converted into internal ones, such that the internal variables are free to take any value while the external ones being bound to to their limits. This non-linear transformation is described in section 1.3.1 in the MINUIT user's guide. As a result of this transformation, a model that is perfectly linear as a function of a bound parameter, becomes non-linear during the minimisation.This can introduce three effects.
which were reported by @pfackeldey in feat: add parameter transformations pfackeldey/evermore#28(these differences were due to choice of single vs double precision, but differences still exist near the parameter bounds due to the round trip).We focus on no. 2. The parameter errors, from
minuit.error
are reported by transforming the interval around the parameter from the internalMINUIT
coordinate space to the external user's space, via the Jacobian of the transformation. On the other hand, the covariance matrix reported byMINUIT
throughminuit.covariance
(asestimated byHESSE
orMIGRAD
) is transformed into user space using only the derivative at the best-fit point (https://root-forum.cern.ch/t/fit-errors-from-covariance-matrix/20772).In the case where the parameter interval is far from the parameter limits, the reported error and the square-root of the diagonal covariance elements are almost the same, as the linear approximation in the covariance transformation method holds. Once the parameter approaches its limit, the transformation function becomes non-linear, the Jacobian deviate from unity, and the two methods start reporting very different errors. Both methods are approximations, and hence there is no clear preference on what's best, and that's why in general
MINUIT
recommends not using limits at all, unless they are absolutely necessary to maintain a physical parameter value.I wrote a very simple linear model, with 1 sample, 1 channel and 1 normalisation factor to demonstrate this effect (code shown in Snippet 1 below). The results are shown in this plot:
Which demonstrate that for a given fit result, the more we shrink the parameter bounds to be closer to that result, the more we see the strange behaviour due to the parameter transformations. In (Snippet 2), a fit is performed directly with
minuit
using the samepyhf
model, testing the effect of the transformations as we impose a one-sided parameter bound, and when we remove parameter bounds completely. The results are:The reason one-sided (lower) bound give a different result to two-sided ones, despite the fitted interval being close to the lower bound, is because
MINUIT
uses a different transformation for one-sided parameter bounds, which is implemented here.Snippet 1
Snippet 2
Beta Was this translation helpful? Give feedback.
All reactions