I try to implement gridsearchcv and then rfecv on svm
from sklearn.feature_selection import RFECV
from sklearn.model_selection import GridSearchCV
from sklearn.svm import SVC
from sklearn.metrics import classification_report
param_grid = {'C': [0.1, 1, 10, 100, 1000],
'gamma': [1, 0.1, 0.01, 0.001, 0.0001],
'kernel': ['linear','rbf','sigmoid']}
estimator = SVC(probability = True, coef0 = 1.0)
clf = GridSearchCV (estimator, param_grid, cv=10, verbose=True)
clf.fit(data_train, label_train)
selector = RFECV(estimator, step = 1, cv= 10)
selector.fit(data_train, label_train)
label_predicted = selector.predict(data_test)
print(classification_report(label_test, label_predicted, digits=4))
it shows an error
ValueError: when importance_getter=='auto', the underlying estimator SVC should have coef_ or feature_importances_ attribute. Either pass a fitted estimator to feature selector or call fit before calling transform.
here is output image