On 03/22/2012 10:58 AM, Andreas wrote:
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.
@devs:
So what I think is the problem here is that RFE and RFECV can not set
parameters of the estimator they are passed.
If there was ``**kwargs`` or a ``estimator_params`` option, the
parameter of the estimator could be passed to
RFE in the grid search.
Does that make sense to you?
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
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general