Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasalmeida committed Dec 12, 2024
2 parents 45612e4 + e9a6816 commit 6d54909
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
fminsearch(fun,Parm0,x,y,Opt)
```

Source code at [https://github.com/jonasalmeida/fminsearch](https://github.com/jonasalmeida/fminsearch), can be loaded into web application with
```html
<script src="https://jonasalmeida.github.io/fminsearch/fminsearch.js"></script>
```

### Multiparametric nonlinear regression in *javascript*.

The same function is kept (that is where it was originally developed) at <http://jmat.googlecode.com>, see <https://jmat.googlecode.com/git/jmat.js>. The purpose is to develope a simple heuristic for non-linear regression that makes the most of javascript's functional style, and specifically of Map-Reduce patterns, while demanding the least from the browser. The algorithm development has a core regression thread that is elaborated through the use of Options (Opt). These options range from the basic of setting the display and controlling the number of iterations, all the way to configuring the output variable, setting th cost function and executing paralelized Genetic Algorithm style.
I developed this function originally at <http://jmat.googlecode.com>, i.e. <https://jmat.googlecode.com/git/jmat.js>, which Google has since discontinued, so I moved it [here](https://github.com/jonasalmeida/jmat/blob/gh-pages/jmat.js#L680) 8 years ago. The purpose of *fminsearch* is to provide a simple heuristic for non-linear regression that makes the most of javascript's functional style, and specifically of Map-Reduce patterns, while demanding as little as possible from the browser, or from developers using it as part of their own work. The steepest descent proceedure has a core regression thread with optional parameters (Opt). These options range from the basic of setting the display and controlling the number of iterations, all the way to configuring the output variable, setting the cost function to applying a paralelized Genetic Algorithm-style penalty on divergent parameter vectors.

### Core algorithm

Expand Down Expand Up @@ -35,7 +40,7 @@ for(var j=0;j<n;j++){ // take a step for each parameter
x = [32,37,42,47,52,57,62,67,72,77,82,87,92]
y=[749,1525,1947,2201,2380,2537,2671,2758,2803,2943,3007,2979,2992]
fun = function(x,P){return x.map(function(xi){return (P[0]+1/(1/(P[1]*(xi-P[2]))+1/P[3]))})}
Parms=jmat.fminsearch(fun,[100,30,10,5000],x,y)
Parms=fminsearch(fun,[100,30,10,5000],x,y)
```

Opt is an object will all other parameters, from the objective function (cost function), to the
Expand All @@ -49,4 +54,4 @@ Parms=jmat.fminsearch(fun,[100,30,10,5000],x,y),{maxIter:10000,display:false})

### License

fminsearch is [MIT licensed](./LICENSE).
fminsearch is [MIT licensed](./LICENSE).
2 changes: 2 additions & 0 deletions fminsearch.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// moving fminsearch to ES6 - under development!

console.log(`fminsearch.mjs imported \n${Date()}`);

// illustrative examples of fun
Expand Down Expand Up @@ -78,3 +79,4 @@ export {
logistic,
fminsearch
}

0 comments on commit 6d54909

Please sign in to comment.