SciPyMinimizer

class minkit.SciPyMinimizer(evaluator, **minimizer_config)[source]

Bases: minkit.Minimizer

Interface with the scipy.optimize.minimize() function.

Parameters

evaluator (UnbinnedEvaluator, BinnedEvaluator or SimultaneousEvaluator) – evaluator to be used in the minimization.

Attributes Summary

evaluator

Evaluator of the minimizer.

Methods Summary

asymmetric_errors(name[, cov, sigma, atol, …])

Calculate the asymmetric errors for the given parameter.

fcn_profile(wa, values)

Evaluate the profile of an FCN for a set of parameters and values.

minimization_profile(wa, values[, …])

Minimize a PDF an calculate the FCN for each set of parameters and values.

minimize(*args, **kwargs)

Minimize the FCN for the stored PDF and data sample.

restoring_state()

Method to ensure that modifications of parameters within a minimizer context are reset properly.

scipy_minimize([method, tol, hessian_opts])

Minimize the PDF using the provided method and tolerance.

set_parameter_state(name[, value, error, fixed])

Method to ensure that a modification of a parameter within a minimizer context is treated properly.

Attributes Documentation

evaluator

Evaluator of the minimizer.

Methods Documentation

asymmetric_errors(name, cov=None, sigma=1, atol=1e-08, rtol=1e-05, maxcall=None)

Calculate the asymmetric errors for the given parameter. This is done by subdividing the bounds of the parameter into two till the variation of the FCN is one. Unlike MINOS, this method does not treat new minima.

Parameters
  • name (str) – name of the parameter.

  • cov (numpy.ndarray) – covariance matrix. If provided, the initial values of the parameters will be obtained from them.

  • sigma (float) – number of standard deviations to compute.

  • atol (float) – absolute tolerance for the error.

  • rtol (float) – relative tolerance for the error.

  • maxcall (int or None) – maximum number of calls to calculate each error bound.

fcn_profile(wa, values)

Evaluate the profile of an FCN for a set of parameters and values.

Parameters
  • wa (str or list(str)) – single variable or set of variables.

  • values (numpy.ndarray) – values for each parameter specified in wa.

Returns

Profile of the FCN for the given values.

Return type

numpy.ndarray

minimization_profile(wa, values, minimizer_config=None)

Minimize a PDF an calculate the FCN for each set of parameters and values.

Parameters
Returns

Profile of the FCN for the given values.

Return type

numpy.ndarray

minimize(*args, **kwargs)[source]

Minimize the FCN for the stored PDF and data sample. It returns a tuple with the information whether the minimization succeded and the covariance matrix.

See also

scipy_minimize

restoring_state()

Method to ensure that modifications of parameters within a minimizer context are reset properly. Sadly, the iminuit.Minuit class is not stateless, so each time a parameter is modified it must be notified of the change.

Warning

For the MinuitMinimizer class, a call to this method does not preserve the minimization state of MIGRAD.

scipy_minimize(method='L-BFGS-B', tol=None, hessian_opts=None)[source]

Minimize the PDF using the provided method and tolerance. Only the methods (‘L-BFGS-B’, ‘TNC’, ‘SLSQP’, ‘trust-constr’) are allowed.

Parameters
  • method (str) – method parsed by scipy.optimize.minimize().

  • tol (float) – tolerance to be used in the minimization.

  • hessian_opts (dict) – options to be passed to numdifftools.core.Hessian().

Returns

result of the minimization and covariance matrix.

Return type

scipy.optimize.OptimizeResult, numpy.ndarray

set_parameter_state(name, value=None, error=None, fixed=None)

Method to ensure that a modification of a parameter within a minimizer context is treated properly. Sadly, the iminuit.Minuit class is not stateless, so each time a parameter is modified it must be notified of the change.

Parameters
  • name (str) – name of the parameter.

  • value (float or None) – new value of a parameter.

  • error (float or None) – error of the parameter.

  • fixed (bool or None) – whether to fix the parameter.