ml-curve-fitting
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "ml-curve-fitting", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Levenberg Marquardt curve-fitting: minimize sum of weighted squared residuals", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
{ | ||
"name": "ml-curve-fitting", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Levenberg Marquardt curve-fitting: minimize sum of weighted squared residuals", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
105
README.md
@@ -1,93 +0,26 @@ | ||
# Levenberg Marquardt curve-fitting | ||
# ml-curve-fitting | ||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![npm download][download-image]][download-url] | ||
Levenberg Marquardt curve-fitting | ||
minimize sum of weighted squared residuals. Javascript version of matlab library from Henri Gavin. | ||
See example for usage | ||
## Installation | ||
## --------- INPUT VARIABLES ----------- | ||
func = function of n independent variables, 't', and m parameters, 'p', | ||
returning the simulated model: y_hat = func(t,p,c) | ||
p = n-vector of initial guess of parameter values | ||
t = m-vectors or matrix of independent variables (used as arg to func) | ||
y_dat = m-vectors or matrix of data to be fit by func(t,p) | ||
weight = weighting vector for least squares fit ( weight >= 0 ) ... | ||
inverse of the standard measurement errors | ||
Default: sqrt(d.o.f. / ( y_dat' * y_dat )) | ||
dp = fractional increment of 'p' for numerical derivatives | ||
dp(j)>0 central differences calculated | ||
dp(j)<0 one sided 'backwards' differences calculated | ||
dp(j)=0 sets corresponding partials to zero; i.e. holds p(j) fixed | ||
Default: 0.001; | ||
p_min = n-vector of lower bounds for parameter values | ||
p_max = n-vector of upper bounds for parameter values | ||
c = an optional matrix of values passed to func(t,p,c) | ||
opts = vector of algorithmic parameters | ||
parameter defaults meaning | ||
opts(1) = prnt 3 >1 intermediate results; >2 plots | ||
opts(2) = MaxIter 10*Npar maximum number of iterations | ||
opts(3) = epsilon_1 1e-3 convergence tolerance for gradient | ||
opts(4) = epsilon_2 1e-3 convergence tolerance for parameters | ||
opts(5) = epsilon_3 1e-3 convergence tolerance for Chi-square | ||
opts(6) = epsilon_4 1e-2 determines acceptance of a L-M step | ||
opts(7) = lambda_0 1e-2 initial value of L-M paramter | ||
opts(8) = lambda_UP_fac 11 factor for increasing lambda | ||
opts(9) = lambda_DN_fac 9 factor for decreasing lambda | ||
opts(10) = Update_Type 1 1: Levenberg-Marquardt lambda update | ||
2: Quadratic update | ||
3: Nielsen's lambda update equations | ||
`$ npm install ml-curve-fitting` | ||
##---------- OUTPUT VARIABLES ----------- | ||
## [Documentation](./Documentation.md) | ||
p = least-squares optimal estimate of the parameter values | ||
X2 = Chi squared criteria | ||
## License | ||
Henri Gavin, Dept. Civil & Environ. Engineering, Duke Univ. 22 Sep 2013 | ||
modified from: [http://octave.sourceforge.net/optim/function/leasqr.html] | ||
using references by | ||
Press, et al., Numerical Recipes, Cambridge Univ. Press, 1992, Chapter 15. | ||
Sam Roweis [http://www.cs.toronto.edu/~roweis/notes/lm.pdf] | ||
Manolis Lourakis [http://www.ics.forth.gr/~lourakis/levmar/levmar.pdf] | ||
Hans Nielson [http://www2.imm.dtu.dk/~hbn/publ/TR9905.ps] | ||
Mathworks optimization toolbox reference manual | ||
K. Madsen, H.B., Nielsen, and O. Tingleff | ||
[http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/3215/pdf/imm3215.pdf] | ||
[MIT](./LICENSE) | ||
[npm-image]: https://img.shields.io/npm/v/ml-curve-fitting.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/ml-curve-fitting | ||
[travis-image]: https://img.shields.io/travis/mljs/curve-fitting/master.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/mljs/curve-fitting | ||
[download-image]: https://img.shields.io/npm/dm/ml-curve-fitting.svg?style=flat-square | ||
[download-url]: https://npmjs.org/package/ml-curve-fitting |
@@ -86,7 +86,4 @@ /** | ||
var J = Matrix.zeros(Npnt,Npar); | ||
/*var J = new Array(Npnt);//zeros(Npnt,Npar); // Jacobian matrix | ||
for(var i=0;i<Npnt;i++){ | ||
J[i] = new Array(Npar); | ||
}*/ | ||
if (t.length != y_dat.length) { | ||
@@ -127,6 +124,3 @@ console.log('lm.m error: the length of t must equal the length of y_dat'); | ||
//plotcmd='figure(11); plot(t(:,1),y_dat,''og'',t(:,1),y_hat,''-b''); axis tight; drawnow '; | ||
//p_min=p_min(:); p_max=p_max(:); // make column vectors | ||
if(!dp.length || dp.length == 1){ | ||
@@ -133,0 +127,0 @@ var dp_array = new Array(Npar); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53889
12
923
27