-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
sample_weight for lasso, elastic etc #3702
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
Comments
you mean you want sample_weight support for Lasso and ElasticNet? |
Yes, exactly. On Sep 25, 2014, at 11:24 AM, Alexandre Gramfort notifications@github.com wrote:
|
it's rather trivial if you don't fit intercept or if you use dense data but |
Yes, I can work around it but it is implemented for ridge now and I think it would be nice to have a consistent API. |
feel free to send a PR |
I too use the Lasso for timeseries analysis, and have inputs with measurement uncertainties. Weights would be invaluable. Just how difficult would it be to implement? I'd be willing to try my hand at it, if nobody else is (reading suggestions would be welcomed). |
it's related to @giorgiop PR on sample weights fix for linear models. Once
this is fixed it should be straight forward to implement.
|
You're referring to #5526? I wonder if I can help somehow... |
I see. Godspeed! |
I think a weighted lass/lars would be welcome. I suggest not to wait until my work get merged, it may take a little while. |
Oh? I got the impression the bug you're working on was blocking this. Are there any pitfalls to watch out for then? |
As part of the "etc" in the question, also for validation_curve! This would probably just be a pass through argument to the actual model being run. In my case, sample_weight works fine for SVR but validation_curve doesn't accept it even when I'm running it on SVRs varying the gamma parameter. |
Have you tried fit_params?
|
@jnothman, I see a set_params method for SVR that would be perfect, but no similar method in validation_curve. Could be misunderstanding your suggestion though. |
fit_params is not set_params. you are right, it's not in validation_curve,
but it is in cross_validation
|
I have opened issue #10252
|
Hi. Are there current plans to incorporate sample_weight into Lasso, ElasticNet etc. the way it is done in Ridge? Thanks. |
it should not be hard to do. You can give it a try. See many first if this
is no open PR doing this.
|
It does not seem like any PR is currently addressing this. I gave it a try but am not familiar enough with the codebase to implement it. Would be great to see this feature implemented tho! |
+1 that this would be useful feature. |
+1 also need this |
This would be super useful! |
Correct me if I'm wrong (and I very well may be wrong), but my understanding is that for values Gram = np.dot(X.T * sample_weight, X)
Xy = np.dot(X.T * sample_weight, y)
sklearn.linear_model.lars_path_gram(Xy, Gram, y.size, method="lasso")
# or equivalently
sklearn.linear_model.lars_path(X=None, y=y, Xy=Xy, Gram=Gram, method="lasso") Wish I had time to write up a PR incorporating this into |
Is anyone working on this? If not, I might give it a try. scikit-learn/sklearn/linear_model/ridge.py Line 437 in 5c9f090
Or am I missing something? |
The sparse case with
|
It will be very helpful to have sample_weight for ElasticNet and Lasso |
@szs8 @nathanzhang3 #15436 is merged and enables Should we close this issue or keep it open until |
keep this open and add tick boxes with on top of the issue with what is
left to do. thx
… |
I see that sample_weight is available for Lasso, is there a way to make it available for LassoCV too? |
@biprateep #16449 addresses |
🎉 |
I am using lasso for time-series data and I would like to decay old data with a weight vector. Any reason why this is not available for lasso?
Meanwhile, if I fit lasso with X = dot(sqrt(diag(weights)), X) and y = dot(sqrt(diag(weights)), y), would it mean the same thing?
Thanks!
Edit:
TODOs
Lasso
andElasticNet
(solved in [MRG] Sample weights for ElasticNet #15436)ElasticNetCV
[MRG] Sample weights for ElasticNetCV #16449X
ENH add sample_weight to sparse coordinade descent #22808The text was updated successfully, but these errors were encountered: