You could use 
grid2.best_estimator_.named_steps['feature_selection'].get_support(),
or .transform(feature_names) instead of .get_support(). Note for instance
that if you have a pipeline of multiple feature selectors, for some reason,
.transform(feature_names) remains useful while .get_support() does not
reflect the input space.

A simpler interface might allow a pipeline to be indexed directly:
grid2.best_estimator_['feature_selection'].get_support();
elsewhere we've also spoken of things like being able to
do grid2.best_estimator_[:1].transform(...). Both of these involve some
magic and Gaƫl tends strongly against API magic where it's custom to few
classes. (BaseEnsemble has some that recently got us into trouble.)

On 12 February 2015 at 08:31, Andy <t3k...@gmail.com> wrote:

>
> On 02/11/2015 04:22 PM, Timothy Vivian-Griffiths wrote:
> > Hi Gilles,
> >
> > Thank you so much for clearing this up for me. So, am I right in
> thinking that the feature selection is carried for every CV-fold, and then
> once the best parameters have been found, the pipeline is then run on the
> whole training set in order to get the .best_estimator_?
> Yes.
> >
> > One final thing, I did manage to find out which of the predictors were
> being chosen for the .best_estimator_ but it was not immediately clear how
> to do it. In the end, I isolated them by doing the following:
> >
> > chosen_predictors = grid2.best_estimator_.steps[0][1].get_support()
> >
> I don't think there is an easier way to do this.
> If you have any idea how to expose this easier, suggestions welcome ;)
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to