npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

curve-fitting

v0.0.5

Published

Levenberg Marquardt curve-fitting: minimize sum of weighted squared residuals

Downloads

15

Readme

Levenberg Marquardt curve-fitting

minimize sum of weighted squared residuals. Javascript version of matlab library from Henri Gavin.

See example for usage

--------- 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

##---------- OUTPUT VARIABLES -----------

p = least-squares optimal estimate of the parameter values

X2 = Chi squared criteria

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]