DefaultToyStrategy#
- class zfit.minimize.DefaultToyStrategy[source]#
Bases:
PushbackStrategy
,ToyStrategyFail
Same as
PushbackStrategy
, but does not raise an error on full failure, instead return an invalid FitResult.This can be useful for toy studies, where multiple fits are done and a failure should simply be counted as a failure instead of rising an error.
Pushback by adding
nan_penalty * counter
to the loss if NaNs are encountered.The counter indicates how many NaNs occurred in a row. The
nan_tol
is the upper limit, if this is exceeded, the fallback will be used and an error is raised.- Parameters:
nan_penalty – Value to add to the previous loss in order to penalize the step taken.
nan_tol – If the number of NaNs encountered in a row exceeds this number, the fallback is used.