sloisel / numeric

Numerical analysis in Javascript
http://www.numericjs.com/
Other
1.42k stars 176 forks source link

Least square solution #53

Open paulhayes opened 10 years ago

paulhayes commented 10 years ago

I wasn't sure where else to post this question. It's not technically a bug but more a missing feature.

I'm porting some code I originally wrote in python/numpy, into javascript/numeric.

I'm finding numeric very good so far, but I know need to find the least square solution for a non square matrix. In numpy this is achieved with numpy.linalg.lstsq, but there's no direct equivalent I could find in numeric.

Could you possibly offer me a short way of achieving this using numeric? I'm aware I can write my own least square solver, but as it's a common problem I thought maybe there's a way that I hadn't noticed by reading through the documentation.

Thank you for taking the time to help me.

reptillicus commented 10 years ago

I'm intersted in this as well. I'm going to take a stab at a general Levenburg-Marquardt solver one of these days, haven't had the time or brain function lately. If anyone else is interested let me know.

On Wed, Feb 5, 2014 at 6:37 AM, Paul Hayes notifications@github.com wrote:

I wasn't sure where else to post this question. It's not technically a bug but more a missing feature.

I'm porting some code I originally wrote in python/numpy, into javascript/numeric.

I'm finding numeric very good so far, but I know need to find the least square solution for a non square matrix. In numpy this is achieved with numpy.linalg.lstsq, but there's no direct equivalent I could find in numeric.

Could you possibly offer me a short way of achieving this using numeric? I'm aware I can write my own least square solver, but as it's a common problem I thought maybe there's a way that I hadn't noticed by reading through the documentation.

Thank you for taking the time to help me.

Reply to this email directly or view it on GitHubhttps://github.com/sloisel/numeric/issues/53 .

Ravenwater commented 10 years ago

+1 On 2/5/2014 11:57 AM, Joe Meiring wrote:

I'm intersted in this as well. I'm going to take a stab at a general Levenburg-Marquardt solver one of these days, haven't had the time or brain function lately. If anyone else is interested let me know.

On Wed, Feb 5, 2014 at 6:37 AM, Paul Hayes notifications@github.com wrote:

I wasn't sure where else to post this question. It's not technically a bug but more a missing feature.

I'm porting some code I originally wrote in python/numpy, into javascript/numeric.

I'm finding numeric very good so far, but I know need to find the least square solution for a non square matrix. In numpy this is achieved with numpy.linalg.lstsq, but there's no direct equivalent I could find in numeric.

Could you possibly offer me a short way of achieving this using numeric? I'm aware I can write my own least square solver, but as it's a common problem I thought maybe there's a way that I hadn't noticed by reading through the documentation.

Thank you for taking the time to help me.

Reply to this email directly or view it on GitHubhttps://github.com/sloisel/numeric/issues/53 .

— Reply to this email directly or view it on GitHub https://github.com/sloisel/numeric/issues/53#issuecomment-34209152.

sebleedelisle commented 10 years ago

+1

paulhayes commented 10 years ago

Hi again, I've written a least square solver that should be easy to integrate into the numeric library. Sorry for not forking the project, and doing a pull request, but I've run out of time to spend on this.

https://gist.github.com/paulhayes/8888586

I've tested it, and it does work. Promise!

reptillicus commented 8 years ago

Finally got around to this, here's a demo page: http://josephmeiring.github.io/jsfit/

and here is the repo: http://josephmeiring.github.io/jsfit/

Its working pretty good for me, let me know if you are using it or if you find some bugs.

paulhayes commented 8 years ago

Hi @josephmeiring did you realise you posted the github.io page twice?