<div dir="ltr"><div dir="ltr"><pre style="margin:0px;line-height:125%">Hi,<br><br>Assuming that you have trained your pipeline, the following piece of code should work.<br></pre><pre style="margin:0px;line-height:125%"><br>pipeline.named_steps[<span style="color:rgb(163,21,21)">"feature_sel"</span>].transform(X)<br><br></pre>Best,</div><div>Chris<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 6, 2021 at 12:52 PM mitali katoch <<a href="mailto:mitalikatoch@gmail.com">mitalikatoch@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"> Dear Scikit team,<div><br></div><div>I am working with FeatureUnion in the pipeline and best parameters are as follows:</div><div>Pipeline(steps=[('feature_sel',<br> FeatureUnion(transformer_list= [ ('selectk', SelectKBest(k=500)),<br> ('sel_fromModel',<br> SelectFromModel(estimator=LogisticRegression(C=1,<br> penalty='l1',<br> solver='liblinear'),<br> max_features=100))]</div><div>)),<br> ('sampler', SMOTE(k_neighbors=2, random_state=10)),<br> ('model', SVC(random_state=10))]</div><div>)<br></div><div><br></div><div>I would like to extract those SelectKBest(k=500) and max_features=100 from the pipeline.</div><div><br></div><div>Could you please confirm whether it is possible to do it, If yes, could you share the solution, I would highly appreciate that.</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Best Regards,</div><div>Mitali Katoch</div><div></div><div><br></div></div>
_______________________________________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br>
</blockquote></div></div>