I want to do a grid search that does two things at once: chooses the right
value for C, the regularization parameter, and does feature selection with
recursive feature elimination.

As a reminder, here's how you usually use the Recursive Feature Elimination
Cross Validation (RFECV) method:

from sklearn.feature_selection import RFECV
from sklearn.svm import SVR

estimator = SVR(kernel="linear", C=100)
selector = RFECV(estimator, step=1, cv=5)
selector = selector.fit(X, y)


I also I tried the following:

parameters = {"estimator": (LogisticRegression(C=100)
, LogisticRegression(C=1000))}
clf = GridSearchCV(RFECV(step=1 cv=StratifiedKFold(y, 2)),
loss_func=zero_one)
clf.fit(X, y)


Unsurprisingly, the above code doesn't work because it's not possible to
initialize a RFECV object without an estimator.  But I can't pass it an
estimator yet because I want to vary the value of C that is used in
initializing the estimator.  Can someone show me how this is done?

Thanks,

Conrad
------------------------------------------------------------------------------
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

Reply via email to