On 03/22/2012 10:56 AM, Conrad Lee wrote:
@Andreas The Pipeline is designed to do exactly this: http://scikit-learn.org/dev/modules/generated/sklearn.pipeline.Pipeline.html#sklearn.pipeline.Pipeline Example here: http://scikit-learn.org/dev/auto_examples/feature_selection_pipeline.html#example-feature-selection-pipeline-py You can use it to build an estimator that does both things and has both parameters.I puzzled over this for a while but didn't find a way to make this work with the pipeline. The problem seems to be that I don't want to perform two steps sequentially. That is, I don't first want to do the recursive feature elimination, and then with that reduced set of features find the best value of C for regularization. The problem with this is that the recursive feature elimination already depends on the value of C. So I want the search for the right value of C to take place within the recursive feature elimination, not after it.
You're right, I (as usual) judged to fast.I think it is not possible to use GridSearchCV directly, but you can build a custom grid search using IterGrid <http://scikit-learn.org/dev/modules/generated/sklearn.grid_search.IterGrid.html#sklearn.grid_search.IterGrid> and cross_val_score <http://scikit-learn.org/dev/modules/generated/sklearn.grid_search.IterGrid.html#sklearn.grid_search.IterGrid>. So you have to write the for-loop over the parameters yourself using IterGrid and then use cross_val_score
to judge the fitness of a given parameter set. Cheers, Andy
------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
