mpicbg.imglib.algorithm.peak

## Class LevenbergMarquardtSolver

• ```public class LevenbergMarquardtSolver
extends Object```
A collection of static utils implementing a plain Levenberg-Marquardt least-square curve fitting algorithm.

It was adapted and stripped from jplewis (www.idiom.com/~zilla) and released under the GPL. There are various small tweaks for robustness and speed, mainly a first step to derive a crude estimate, based on maximum-likelihood analytic formulae.

Author:
Jean-Yves Tinevez 2011, 2012
• ### Constructor Summary

Constructors
Constructor and Description
`LevenbergMarquardtSolver()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static double` ```chiSquared(double[][] x, double[] a, double[] y, FitFunction f)```
Calculate the current sum-squared-error
`static int` ```solve(double[][] x, double[] a, double[] y, FitFunction f, double lambda, double termepsilon, int maxiter)```
Minimize E = sum {(y[k] - f(x[k],a)) }^2 Note that function implements the value and gradient of f(x,a), NOT the value and gradient of E with respect to a!
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### LevenbergMarquardtSolver

`public LevenbergMarquardtSolver()`
• ### Method Detail

• #### chiSquared

```public static final double chiSquared(double[][] x,
double[] a,
double[] y,
FitFunction f)```
Calculate the current sum-squared-error
• #### solve

```public static final int solve(double[][] x,
double[] a,
double[] y,
FitFunction f,
double lambda,
double termepsilon,
int maxiter)
throws Exception```
Minimize E = sum {(y[k] - f(x[k],a)) }^2 Note that function implements the value and gradient of f(x,a), NOT the value and gradient of E with respect to a!
Parameters:
`x` - array of domain points, each may be multidimensional
`y` - corresponding array of values
`a` - the parameters/state of the model
`lambda` - blend between steepest descent (lambda high) and jump to bottom of quadratic (lambda zero). Start with 0.001.
`termepsilon` - termination accuracy (0.01)
`maxiter` - stop and return after this many iterations if not done
Returns:
the number of iteration used by minimization
Throws:
`Exception`