[scikit-learn] LassoCV.coef not implemented (I think)
Robert Slater
rdslater at gmail.com
Sun Jan 31 15:22:16 EST 2021
Appreciate the clarification. I definitely think the docs need some polish
as coef_ only returns a single fitting of coefficients and not the
coefficients along the path as stated in the api guide.
I am seeing
alpha_
alphas_
coef_
dual_gap_
as fitted variables (plus a few more) which is slightly different than the
guide/api docs (all the names are plural in the api guide)
I don't know if there is way to contribute an edit to the docs, I'd be more
than happy to do it (Sorry I'm very OCD about such things, and I know this
is a minor details)., I'd be happy to suggest the edit through proper
channels.
On Sun, Jan 31, 2021 at 2:02 PM Guillaume Lemaître <g.lemaitre58 at gmail.com>
wrote:
> Hi Robert,
>
> > I do have a .coef_ variable which I believe is the coefficient for the
> best fit only.
>
> `coef` never existed. Fitted attributes always end with underscore.
> We do not store coefficients for all fitted `alphas_`.
> We provide some information regarding the MSE path for all tried alphas:
> https://scikit-learn.org/stable/auto_examples/linear_model/plot_lasso_model_selection.html
>
> > the alphas and alphas_ variables have a similar issue in that alphas
> returns nothing while alphas_ returns the list of alphas used.
>
> You probably created a model such as `model = LasssoCV()`. By default, the
> parameter `alpha=None` thus accessing it will return None. After fitting,
> `alphas_` will be automatically created as specified in the documentation.
> It will correspond to the values tried by cross-validation.
> If instead, you are passing an array to `alphas` then `alphas_` will be
> the same as `alphas_` after calling `fit`.
>
> Cheers,
>
>
> On Sun, 31 Jan 2021 at 20:45, Robert Slater <rdslater at gmail.com> wrote:
>
>> I was writing an example for my students when I came across what I think
>> is an issue. In version 24.1 using the LassoCV, the <object>.coef variable
>> should have a list of my coeficeients (at least according to my
>> understanding of the documents). However, the variable is not populated
>> nad throws an error
>>
>> 'LassoCV' object has no attribute 'coef'
>>
>>
>> I do have a .coef_ variable which I believe is the coefficient for the
>> best fit only.
>>
>> the alphas and alphas_ variables have a similar issue in that alphas
>> returns nothing while alphas_ returns the list of alphas used.
>>
>> I'm not sure if this is an documentation oversight or a real issue but
>> wanted to get clarification.
>>
>> I can get what I need from o ther methods, but wanted to see if this
>> needed to be addressed.
>>
>> Best Regards,
>>
>> Robert Slater
>> _______________________________________________
>> scikit-learn mailing list
>> scikit-learn at python.org
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>
>
> --
> Guillaume Lemaitre
> Scikit-learn @ Inria Foundation
> https://glemaitre.github.io/
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scikit-learn/attachments/20210131/90d0edf2/attachment-0001.html>
More information about the scikit-learn
mailing list