I want to apply Recursive Feature Elimination (RFE) on a model that is built using Keras models and layers. When I run:
from sklearn.feature_selection import RFE
## building Keras model ... #
rfe = RFE(model, 3)
rfe = rfe.fit(X_train, y_train)
I get following error:
TypeError: Cannot clone object '<keras.models.Sequential object at 0x7f1ab93eb510>' (type <class 'keras.models.Sequential'>): it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' methods.
I tried to clone my Keras model by clone_model(model)
, but it did not help.
Do I have to use sklearn estimator to be able to use RFE?