class zfit.minimizers.minimizer_minuit.Minuit(strategy: zfit.minimizers.baseminimizer.ZfitStrategy = None, minimize_strategy: int = 1, tolerance: float = None, verbosity: int = 5, name: str = None, ncall: int = 10000, use_minuit_grad: bool = None, **minimizer_options)[source]

Bases: zfit.minimizers.baseminimizer.BaseMinimizer, zfit.util.cache.Cachable

  • () (strategy) – A ZfitStrategy object that defines the behavior of

  • minimizer in certain situations. (the) –

  • minimize_strategy (int) – A number used by minuit to define the strategy, either 0, 1 or 2.

  • tolerance (float) – Stopping criteria: the Estimated Distance to Minimum (EDM) has to be lower then tolerance

  • verbosity (int) – Regulates how much will be printed during minimization. Values between 0 and 10 are valid.

  • name (str) – Name of the minimizer

  • ncall (int) – Maximum number of minimization steps.

  • use_minuit_grad (bool) – If True, iminuit uses it’s internal numerical gradient calculation instead of the (analytic/numerical) gradient provided by TensorFlow/zfit.

add_cache_dependents(cache_dependents: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]], allow_non_cachable: bool = True)

Add dependents that render the cache invalid if they change.

  • cache_dependents (ZfitCachable) –

  • allow_non_cachable (bool) – If True, allow cache_dependents to be non-cachables. If False, any cache_dependents that is not a ZfitCachable will raise an error.


TypeError – if one of the cache_dependents is not a ZfitCachable _and_ allow_non_cachable if False.

graph_caching_methods = []
instances = <_weakrefset.WeakSet object>
minimize(loss: zfit.core.interfaces.ZfitLoss, params: Optional[Iterable[zfit.core.interfaces.ZfitParameter]] = None) → zfit.minimizers.fitresult.FitResult

Fully minimize the loss with respect to params.

  • loss (ZfitLoss) – Loss to be minimized.

  • params (list(zfit.Parameter) – The parameters with respect to which to minimize the loss. If None, the parameters will be taken from the loss.


The fit result.

Return type


register_cacher(cacher: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]])

Register a cacher that caches values produces by this instance; a dependent.


() (cacher) –

reset_cache(reseter: zfit.util.cache.ZfitCachable)

Clear the cache of self and all dependent cachers.

step(loss, params: Union[Iterable[zfit.core.interfaces.ZfitParameter], None, Iterable[str]] = None)

Perform a single step in the minimization (if implemented).


() (params) –



MinimizeStepNotImplementedError – if the step method is not implemented in the minimizer.

property tolerance