minimize

zfit.minimize.MinuitMinimizer

alias of zfit.minimizers.minimizer_minuit.Minuit

zfit.minimize.ScipyMinimizer

alias of zfit.minimizers.minimizers_scipy.Scipy

zfit.minimize.AdamMinimizer

alias of zfit.minimizers.optimizers_tf.Adam

class zfit.minimize.WrapOptimizer(optimizer, tolerance=None, verbosity=None, name=None, **kwargs)[source]

Bases: zfit.minimizers.baseminimizer.BaseMinimizer

copy()
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.

Parameters
  • 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.

Returns

The fit result.

Return type

FitResult

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

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

Parameters

() (params) –

Returns:

Raises

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

property tolerance
class zfit.minimize.Adam(tolerance=None, learning_rate=0.2, beta1=0.9, beta2=0.999, epsilon=1e-08, use_locking=False, name='Adam', **kwargs)[source]

Bases: zfit.minimizers.base_tf.WrapOptimizer

copy()
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.

Parameters
  • 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.

Returns

The fit result.

Return type

FitResult

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

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

Parameters

() (params) –

Returns:

Raises

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

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

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

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

  • minimizer in certain situations. (the) –

  • () – A number used by minuit to define the strategy

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

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

  • () – Name of the minimizer

  • () – Maximum number of minimization steps.

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.

Parameters
  • 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.

Raises

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

copy()[source]
graph_caching_methods = []
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.

Parameters
  • 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.

Returns

The fit result.

Return type

FitResult

old_graph_caching_methods = []
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.

Parameters

() (cacher) –

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

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).

Parameters

() (params) –

Returns:

Raises

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

property tolerance
class zfit.minimize.Scipy(minimizer='L-BFGS-B', tolerance=None, verbosity=5, name=None, **minimizer_options)[source]

Bases: zfit.minimizers.baseminimizer.BaseMinimizer

copy()
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.

Parameters
  • 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.

Returns

The fit result.

Return type

FitResult

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

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

Parameters

() (params) –

Returns:

Raises

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

property tolerance
class zfit.minimize.BFGS(strategy: zfit.minimizers.baseminimizer.ZfitStrategy = None, tolerance: float = 1e-05, verbosity: int = 5, name: str = 'BFGS_TFP', options: Mapping = None)[source]

Bases: zfit.minimizers.baseminimizer.BaseMinimizer

Parameters
  • strategy (ZfitStrategy) – Strategy that handles NaN and more (to come, experimental)

  • tolerance (float) – Difference between the function value that suffices to stop minimization

  • verbosity – The higher, the more is printed. Between 1 and 10 typically

  • name – Name of the Minimizer

  • options – A dict containing the options given to the minimization function, overriding the default

copy()
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.

Parameters
  • 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.

Returns

The fit result.

Return type

FitResult

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

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

Parameters

() (params) –

Returns:

Raises

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

property tolerance