Limit determination fails to converge #448
-
Hello @matthewfeickert @alexander-held ! Daarii is doing some fits, and is getting an intermittent error depending on what variable we fit on. Could you guide us to how to interface w/ scipy.optimize via cabinetry to converge? DEBUG - cabinetry.fit - Signal_norm = 0.1000, expected -2 sigma CLs = 0.0500 (cached)
DEBUG - cabinetry.fit - Signal_norm = 0.1000, expected -2 sigma CLs = 0.0500 (cached)
ERROR - cabinetry.fit - CLs values at 0.1000 and 0.1000 do not bracket CLs=0.0500, try a different starting bracket
Traceback (most recent call last):
File "/lustre/fs22/group/atlas/dbattulga/MyAnalysis/cabinetry-tutorials/example.py", line 306, in <module>
limit_results = cabinetry.fit.limit(model, data, confidence_level=0.95, poi_tolerance=0.01)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_104/x86_64-centos7-gcc12-opt/lib/python3.9/site-packages/cabinetry/fit/__init__.py", line 959, in limit
res = scipy.optimize.root_scalar(
File "/cvmfs/sft.cern.ch/lcg/views/LCG_104/x86_64-centos7-gcc12-opt/lib/python3.9/site-packages/scipy/optimize/_root_scalar.py", line 275, in root_scalar
r, sol = methodc(f, a, b, args=args, **kwargs)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_104/x86_64-centos7-gcc12-opt/lib/python3.9/site-packages/scipy/optimize/_zeros_py.py", line 784, in brentq
r = _zeros._brentq(f, a, b, xtol, rtol, maxiter, args, full_output, disp)
ValueError: f(a) and f(b) must have different signs Thank you so much!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @nhartman94! What happens here is that This causes the crash here: to get the crossing for -2 sigma, the starting point (lower bound) of DEBUG - cabinetry.fit - Signal_norm = 0.1000, expected -2 sigma CLs = 0.0500 (cached) My guess is that this value is very slightly lower than Setting a different starting bracket via the Footnotes
|
Beta Was this translation helpful? Give feedback.
Hi @nhartman94! What happens here is that
cabinetry
sets a default lower bound of0.1
for the interval it probes to find all the CLs=0.05 crossings. The default upper bound is the upper POI bound set in the workspace (which defaults to10
if not set). That means by default the interval being searched is[0.1, 10]
. The algorithm being used to identify the crossings,scipy.optimize.root_scalar
, does not handle cases where the crossing (which is set up as a root in this case) lies outside the interval provided1.This causes the crash here: to get the crossing for -2 sigma, the starting point (lower bound) of
0.1
already results in a CLs of0.0500
2: