All Projects → mljs → levenberg-marquardt

mljs / levenberg-marquardt

Licence: MIT license
Curve fitting method in JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to levenberg-marquardt

nim-mpfit
A wrapper for the cMPFIT library for the Nim programming language, https://vindaar.github.io/nim-mpfit/
Stars: ✭ 18 (-71.43%)
Mutual labels:  fitting, levenberg-marquardt
libgoldilocks
An implementation of Mike Hamburg's Ed448 (Goldilocks) curve - derived from libdecaf. This is a mirror of https://bugs.otr.im/otrv4/libgoldilocks
Stars: ✭ 17 (-73.02%)
Mutual labels:  curve
Elm Geometry
2D/3D geometry package for Elm
Stars: ✭ 162 (+157.14%)
Mutual labels:  curve
global l0
Global L0 algorithm for regularity-constrained plane fitting
Stars: ✭ 45 (-28.57%)
Mutual labels:  fitting
Naughtybeziercurves
Bezier Curve Game Object for Unity
Stars: ✭ 195 (+209.52%)
Mutual labels:  curve
btc-bash-ng
math and bitcoin tools in gnu bc and bash
Stars: ✭ 25 (-60.32%)
Mutual labels:  curve
Crescento
Add curve at bottom of image views and relative layouts.
Stars: ✭ 1,289 (+1946.03%)
Mutual labels:  curve
MannvilleGroup Strat Hackathon
stratigraphic machine-learning - active work moved to Predictatops
Stars: ✭ 17 (-73.02%)
Mutual labels:  curve
smooth-corners
CSS superellipse masks using the Houdini API
Stars: ✭ 133 (+111.11%)
Mutual labels:  curve
theseus
A library for differentiable nonlinear optimization
Stars: ✭ 1,257 (+1895.24%)
Mutual labels:  levenberg-marquardt
Interactive Data Editor
A Software to interactively edit data in a graphical manner
Stars: ✭ 35 (-44.44%)
Mutual labels:  fitting
Mojs Curve Editor
GUI for live easing/property curves editing
Stars: ✭ 196 (+211.11%)
Mutual labels:  curve
NAGPythonExamples
Examples and demos showing how to call functions from the NAG Library for Python
Stars: ✭ 46 (-26.98%)
Mutual labels:  curve-fitting
Threejs Path Flow
🐬🐟 ↶Mesh Deformation / Bending / Following on a Curve
Stars: ✭ 165 (+161.9%)
Mutual labels:  curve
discrete frechet
Compute the Fréchet distance between two polygonal curves in Euclidean space.
Stars: ✭ 68 (+7.94%)
Mutual labels:  curve
Tinynurbs
C++ library for NURBS curves and surfaces
Stars: ✭ 129 (+104.76%)
Mutual labels:  curve
TBFIT
Tight-binding parameter fitting package (TBFIT) for Slater-Koster method
Stars: ✭ 18 (-71.43%)
Mutual labels:  fitting
Flubber
Flubber is an elegant solution for making animations in Android. The library is developed and maintained by Appolica.
Stars: ✭ 254 (+303.17%)
Mutual labels:  curve
pyeq3
A large collection of equations for Python 3 curve fitting and surface fitting that can output source code in several computing languages, and run a genetic algorithm for initial parameter estimation. Comes with cluster, parallel, IPython, GUI, NodeJS, and web-based graphical examples. Includes orthogonal distance and relative error regressions.
Stars: ✭ 31 (-50.79%)
Mutual labels:  curve-fitting
frechet
Discrete Fréchet distance and of the minimum path required for traversing with it
Stars: ✭ 14 (-77.78%)
Mutual labels:  curve

levenberg-marquardt

NPM version build status Test coverage npm download

Curve fitting method in javascript.

API Documentation

This algorithm is based on the article Brown, Kenneth M., and J. E. Dennis. "Derivative free analogues of the Levenberg-Marquardt and Gauss algorithms for nonlinear least squares approximation." Numerische Mathematik 18.4 (1971): 289-297. and http://people.duke.edu/~hpgavin/ce281/lm.pdf

In order to get a general idea of the problem you could also check the Wikipedia article.

Installation

$ npm i ml-levenberg-marquardt

Options

Next there is some options could change the behavior of the code.

centralDifference

The jacobian matrix is approximated by finite difference; forward differences or central differences (one additional function evaluation). The option centralDifference select one of them, by default the jacobian is calculated by forward difference.

gradientDifference

The jacobian matrix is approximated as mention above, the gradientDifference option is the step size (dp) to calculate de difference between the function with the current parameter state and the perturbation added. It could be a number (same step size for all parameters) or an array with different values for each parameter, if the gradientDifference is zero the derive will be zero, and the parameter will hold fixed

Example

// import library
import LM from 'ml-levenberg-marquardt';
// const LM = require('ml-levenberg-marquardt').default;

// function that receives the parameters and returns
// a function with the independent variable as a parameter
function sinFunction([a, b]) {
  return (t) => a * Math.sin(b * t);
}

// array of points to fit
let data = {
  x: [
    /* x1, x2, ... */
  ],
  y: [
    /* y1, y2, ... */
  ],
};

// array of initial parameter values
let initialValues = [
  /* a, b, c, ... */
];

// Optionally, restrict parameters to minimum & maximum values
let minValues = [
  /* a_min, b_min, c_min, ... */
];
let maxValues = [
  /* a_max, b_max, c_max, ... */
];

const options = {
  damping: 1.5,
  initialValues: initialValues,
  minValues: minValues,
  maxValues: maxValues,
  gradientDifference: 10e-2,
  maxIterations: 100,
  errorTolerance: 10e-3,
};

let fittedParams = LM(data, sinFunction, options);

Or test it in Runkit

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].