Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linear least squares fitting - choosing the right algorithm #968

Closed
thomasaarholt opened this issue Apr 28, 2016 · 5 comments
Closed

Linear least squares fitting - choosing the right algorithm #968

thomasaarholt opened this issue Apr 28, 2016 · 5 comments

Comments

@thomasaarholt
Copy link
Contributor

thomasaarholt commented Apr 28, 2016

I'm struggling trying to choose the right algorithm to incorporate into Hyperspy to do MLLS fitting. Currently I'm using LinearRegression from scikit-learn. Unfortunately, the residual returned by its methods is being deprecated. I've raised an issue about this on their github.

Alternatives include numpy's lstsq and scipy's lstsq.

I'm basically trying to find the easiest way to do this.

@francisco-dlp
Copy link
Member

Personally I would simply pick scipy's lstsq because sklearn's regression is just a wrapper around it. For something so simple, I think that we'll be better off getting it from the source.

We could also take it from numpy, but usually functions that are available from both scipy and numpy tend to be faster in scipy.

@francisco-dlp francisco-dlp added this to the Discussion milestone Apr 28, 2016
@tjof2
Copy link
Contributor

tjof2 commented Apr 29, 2016

A relevant thread: http://stackoverflow.com/questions/29372559/what-is-the-difference-between-numpy-linalg-lstsq-and-scipy-linalg-lstsq

But it looks like scipy now uses xGELSD by default anyway - plus offers a method option to change the LAPACK routine anyway,

@tjof2
Copy link
Contributor

tjof2 commented Feb 14, 2017

See #1321 #1462 #2422

@tjof2
Copy link
Contributor

tjof2 commented Jun 19, 2020

I think you can close this @thomasaarholt given #2422 ?

@thomasaarholt
Copy link
Contributor Author

4 years later :p

@ericpre ericpre removed this from the Discussion milestone Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants