Recursive Feature Elimination on Keras Models

只愿长相守 提交于 2020-01-06 05:26:12

问题


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?

来源:https://stackoverflow.com/questions/48103882/recursive-feature-elimination-on-keras-models

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!