[scikit-learn] Issue regarding Feature Union

Chris Aridas chris at aridas.eu
Thu May 6 06:45:30 EDT 2021


Hi,

Assuming that you have trained your pipeline, the following piece of
code should work.


pipeline.named_steps["feature_sel"].transform(X)

Best,
Chris

On Thu, May 6, 2021 at 12:52 PM mitali katoch <mitalikatoch at gmail.com>
wrote:

>   Dear Scikit team,
>
> I am working with FeatureUnion in the pipeline and best parameters are as
> follows:
> Pipeline(steps=[('feature_sel',
>                  FeatureUnion(transformer_list= [ ('selectk',
> SelectKBest(k=500)),
>                                                 ('sel_fromModel',
>
>  SelectFromModel(estimator=LogisticRegression(C=1,
>
>                     penalty='l1',
>
>                     solver='liblinear'),
>
>  max_features=100))]
> )),
>                 ('sampler', SMOTE(k_neighbors=2, random_state=10)),
>                 ('model', SVC(random_state=10))]
> )
>
> I would like to extract those SelectKBest(k=500) and max_features=100 from
> the pipeline.
>
> Could you please confirm whether it is possible to do it, If yes, could
> you share the solution, I would highly appreciate that.
>
> Thanks in advance.
>
> Best Regards,
> Mitali Katoch
>
> _______________________________________________
> 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/20210506/e141b5d6/attachment.html>


More information about the scikit-learn mailing list