Sorry if I misunderstood your question. On 29 August 2017 at 06:32, Raga Markely <raga.mark...@gmail.com> wrote:
> Sounds good.. tried it and works.. thank you! > > On Mon, Aug 28, 2017 at 3:20 PM, Andreas Mueller <t3k...@gmail.com> wrote: > >> you can also use grid.best_estimator_ (and then all the rest) >> >> On 08/28/2017 03:07 PM, Raga Markely wrote: >> >> Ah.. got it :D.. >> >> The pipeline was run in gridsearchcv.. >> >> It works now after calling fit.. >> >> Thanks! >> Raga >> >> On Mon, Aug 28, 2017 at 2:55 PM, Andreas Mueller <t3k...@gmail.com> >> wrote: >> >>> Have you called "fit" on the pipeline? >>> >>> >>> On 08/28/2017 02:12 PM, Raga Markely wrote: >>> >>> Thank you, Andreas. >>> >>> When I try >>> >>>> pipe_lr.named_steps['clf'].coef_ >>> >>> >>> I get: >>> >>>> AttributeError: 'LogisticRegression' object has no attribute 'coef_' >>> >>> >>> And when I try: >>> >>>> pipe_lr.named_steps['clf'] >>> >>> >>> I get: >>> >>>> LogisticRegression(C=0.1, class_weight=None, dual=False, >>>> fit_intercept=True, intercept_scaling=1, max_iter=100, multi_class='ovr', >>>> n_jobs=1, penalty='l2', random_state=None, solver='liblinear', tol=0.0001, >>>> verbose=0, warm_start=False) >>> >>> >>> I wonder what I am missing? >>> >>> Thanks, >>> Raga >>> >>> >>> On Mon, Aug 28, 2017 at 12:01 PM, Andreas Mueller <t3k...@gmail.com> >>> wrote: >>> >>>> Can can get the coefficients on the scaled data with >>>> pipeline_lr.named_steps_['clf'].coef_ >>>> though >>>> >>>> >>>> On 08/28/2017 12:08 AM, Raga Markely wrote: >>>> >>>> No problem, thank you! >>>> >>>> Best, >>>> Raga >>>> >>>> On Mon, Aug 28, 2017 at 12:01 AM, Joel Nothman <joel.noth...@gmail.com> >>>> wrote: >>>> >>>>> No, we do not have a way to get the coefficients with respect to the >>>>> input (pre-scaling) space. >>>>> >>>>> On 28 August 2017 at 13:20, Raga Markely <raga.mark...@gmail.com> >>>>> wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> I am wondering if it's possible to get the weight coefficients of >>>>>> logistic regression from a pipeline? >>>>>> >>>>>> For instance, I have the followings: >>>>>> >>>>>>> clf_lr = LogisticRegression(penalty='l1', C=0.1) >>>>>>> pipe_lr = Pipeline([['sc', StandardScaler()], ['clf', clf_lr]]) >>>>>>> pipe_lr.fit(X, y) >>>>>> >>>>>> >>>>>> Does pipe_lr have an attribute that I can call to get the weight >>>>>> coefficient? >>>>>> >>>>>> Or do I have to get it from the classifier as follows? >>>>>> >>>>>>> X_std = StandardScaler().fit_transform(X) >>>>>>> clf_lr = LogisticRegression(penalty='l1', C=0.1) >>>>>>> clf_lr.fit(X_std, y) >>>>>>> clf_lr.coef_ >>>>>> >>>>>> >>>>>> Thank you, >>>>>> Raga >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> scikit-learn mailing list >>>>>> scikit-learn@python.org >>>>>> https://mail.python.org/mailman/listinfo/scikit-learn >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> scikit-learn mailing list >>>>> scikit-learn@python.org >>>>> https://mail.python.org/mailman/listinfo/scikit-learn >>>>> >>>>> >>>> >>>> >>>> _______________________________________________ >>>> scikit-learn mailing >>>> listscikit-learn@python.orghttps://mail.python.org/mailman/listinfo/scikit-learn >>>> >>>> >>>> >>>> _______________________________________________ >>>> scikit-learn mailing list >>>> scikit-learn@python.org >>>> https://mail.python.org/mailman/listinfo/scikit-learn >>>> >>>> >>> >>> >>> _______________________________________________ >>> scikit-learn mailing >>> listscikit-learn@python.orghttps://mail.python.org/mailman/listinfo/scikit-learn >>> >>> >>> >>> _______________________________________________ >>> scikit-learn mailing list >>> scikit-learn@python.org >>> https://mail.python.org/mailman/listinfo/scikit-learn >>> >>> >> >> >> _______________________________________________ >> scikit-learn mailing >> listscikit-learn@python.orghttps://mail.python.org/mailman/listinfo/scikit-learn >> >> >> >> _______________________________________________ >> scikit-learn mailing list >> scikit-learn@python.org >> https://mail.python.org/mailman/listinfo/scikit-learn >> >> > > _______________________________________________ > scikit-learn mailing list > scikit-learn@python.org > https://mail.python.org/mailman/listinfo/scikit-learn > >
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn