LevenbergMinimizer

class triqs_maxent.minimizers.levenberg_minimizer.LevenbergMinimizer(convergence=None, maxiter=1000, miniter=0, J_squared=False, marquardt=False, mu0=1e-18, nu=1.3, max_mu=1e+20, verbose_callback=None)[source]

Bases: Minimizer

The Levenberg minimization algorithm.

The task of this algorithm is to minimize a function \(Q\) with respect to a quantity \(H\). That is equivalent to searching a solution to \(f := \partial Q/\partial H = 0\). We assume that the equation is parametrized by a solution vector \(v\) (i.e., we are looking for a solution in \(H(v)\)). We then calculate the matrix \(J = \frac{\partial}{\partial v} \frac{\partial Q}{\partial H}\).

Depending on the settings of the parameters, the solution is searched for in the following way:

  • J_squared=False, marquardt = False: \((J + \mu 1)\delta v = f\)

  • J_squared=False, marquardt = True: \((J + \mathrm{diag} J)\delta v = f\)

  • J_squared=True, marquardt = False: \((J^TJ + \mu 1)\delta v = f\)

  • J_squared=True, marquardt = True: \((J^TJ + \mathrm{diag} J^T J)\delta v = f\)

Then, \(v\) is updated by subtracting \(\delta v\).

The step length is determined by the damping parameter \(\mu\), which is chosen so that \(Q\) is minimal.

Parameters:
convergenceConvergenceMethod

method to check convergence; the default is MaxDerivativeConvergenceMethod(1.e-4) | RelativeFunctionChangeConvergenceMethod(1.e-16)

maxiterint

the maximum number of iterations

miniterint

the minimum number of iterations

J_squaredbool

if True, the algorithm solves \((J^TJ +\mu 1) \delta v = J^T f\), else \((J +\mu 1) \delta v = f\).

marquardtbool

if True, the algorithm uses \(\mathrm{diag}(J)\) or \(\mathrm{diag}(J^T J)\) (depending on the parameter J_squared), instead of the identity matrix.

mu0float

the initial value of the Levenberg damping parameter

nufloat

the relative increase/decrease of mu when necessary

max_mufloat

the maximum number of mu, to prevent infinite loops

verbose_callbackfunction

a function used to print verbosity information e.g., the print function

Attributes:
n_iterint

the total number of iterations performed since the creation of the class

n_iter_lastint

the number of iterations performed when minimize was last called

convergedbool

whether the algorithm converged in fewer than maxiter loops when minimze was last called

minimize(function, v0)[source]

Perform the minimization.

Parameters:
functionDoublyDerivableFunction

the function to be minimized

v0array

the initial function argument \(v\)

Returns:
varray

the vector \(v\) at the minimum