Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Add support for weighted least squares #694

Closed
cesarsouza opened this issue Jul 9, 2017 · 10 comments
Closed

Add support for weighted least squares #694

cesarsouza opened this issue Jul 9, 2017 · 10 comments

Comments

@cesarsouza
Copy link
Member

And update https://stackoverflow.com/questions/41619834/why-weights-in-accrod-net-simplelinearregression-have-no-effect

@peters
Copy link

peters commented Jul 13, 2017

@cesarsouza Would a bounty help speed this one along? And if so, how large? :)

@cesarsouza
Copy link
Member Author

cesarsouza commented Jul 14, 2017

One thousand euros 😉

I am just kidding - actually the support for weights in least squares has already been implemented, but I forgot to reference this issue in the commit: 3ed8e19

If you need it urgently, you can try to clone the framework and compile from the sources (it should be only a matter of selecting the .NET framework version that you need in the configuration box and clicking the green start button in VS as shown below). But I can also try to generate a new pre-release package if you prefer, but it might indeed take a while.

image

Regards,
Cesar

@peters
Copy link

peters commented Jul 14, 2017

@cesarsouza Check your gmail ;) Would you mind creating a pre-release package? 🥇

@peters
Copy link

peters commented Jul 14, 2017

@cesarsouza From a geometric perspective when faced with matrix singularity would you recommend adding some random noise (e.g. +- 5 RNG) to each x/y coordinate or simply removing each pair Point that causes a singularity to occur in the first place?

Source: https://stats.stackexchange.com/a/70910

@cesarsouza
Copy link
Member Author

cesarsouza commented Jul 14, 2017

I am starting to prepare a new pre-release, but it might take some moments until everything compiles and is uploaded to NuGet :-)

Regarding the question, I am not sure about the geometric perspective part, but in case I faced a singular matrix problem when doing linear regression I would just opt to use the SVD to solve it instead. If I am not mistaken, using the SVD should be akin to dropping the linear dependent vectors from the matrix before solving the system, but you wouldn't have to worry about doing this manually.

You can solve OLS using SVD by setting the IsRobust property of the OrdinaryLeastSquares class to true before calling .Learn().

Regards,
Cesar

@peters
Copy link

peters commented Jul 14, 2017

@cesarsouza That makes sense, thanks for the tip. I probably should have mentioned that i was using PolynomialLeastSquares not OrdinaryLeastSquares 🤣

cesarsouza added a commit that referenced this issue Jul 14, 2017
Updates GH-694: Add support for weighted least squares
@cesarsouza
Copy link
Member Author

cesarsouza commented Jul 14, 2017

Oh yeah that would be a nice thing to mention :-) but the technique is the same in both cases. It is nice that you mentioned because the IsRobust was missing from the PolynomialLeastSquares class. I've just added it.

@cesarsouza
Copy link
Member Author

I am uploading the new packages to NuGet, they should be available in about 20-30 minutes :-)

@peters
Copy link

peters commented Jul 14, 2017

@cesarsouza Hehe 🔢 Wow, that was fast :) Looking forward playing around with Weights and IsRobust. I think it will yield a significant when it comes with some edge-cases (NDA) I've been very eager to solve.

@cesarsouza
Copy link
Member Author

Included in release v3.7.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants