ml-levenberg-marquardt

4.1.3

levenbergMarquardt

src/index.js

Curve fitting algorithm

levenbergMarquardt(data: {x: ArrayLike<number>, y: ArrayLike<number>}, parameterizedFunction: function, options: object): {parameterValues: Array<number>, parameterError: number, iterations: number}
Parameters
data ({x: ArrayLike<number>, y: ArrayLike<number>}) Array of points to fit in the format [x1, x2, ... ], [y1, y2, ... ]
parameterizedFunction (function) Takes an array of parameters and returns a function with the independent variable as its sole argument
options (object) Options object
Name Description
options.initialValues ArrayLike<number> Array of initial parameter values
options.weights (number | ArrayLike<number>) (default 1) weighting vector, if the length does not match with the number of data points, the vector is reconstructed with first value.
options.damping number (default 1e-2) Levenberg-Marquardt parameter, small values of the damping parameter λ result in a Gauss-Newton update and large values of λ result in a gradient descent update
options.dampingStepDown number (default 9) factor to reduce the damping (Levenberg-Marquardt parameter) when there is not an improvement when updating parameters.
options.dampingStepUp number (default 11) factor to increase the damping (Levenberg-Marquardt parameter) when there is an improvement when updating parameters.
options.improvementThreshold number (default 1e-3) the threshold to define an improvement through an update of parameters
options.gradientDifference (number | ArrayLike<number>) (default 10e-2) The step size to approximate the jacobian matrix
options.centralDifference boolean (default false) If true the jacobian matrix is approximated by central differences otherwise by forward differences
options.minValues ArrayLike<number>? Minimum allowed values for parameters
options.maxValues ArrayLike<number>? Maximum allowed values for parameters
options.maxIterations number (default 100) Maximum of allowed iterations
options.errorTolerance number (default 10e-3) Minimum uncertainty allowed for each point.
options.timeout number? maximum time running before throw in seconds.
Returns
{parameterValues: Array<number>, parameterError: number, iterations: number}: