我试图找到主导回归模型输出的最佳功能,以下是我的代码。
seed = 7
np.random.seed(seed)
estimators = []
estimators.append(('mlp', KerasRegressor(build_fn=baseline_model, epochs=3,
batch_size=20)))
pipeline = Pipeline(estimators)
rfe = RFE(estimator= pipeline, n_features_to_select=5)
fit = rfe.fit(X_set, Y_set)
Run Code Online (Sandbox Code Playgroud)
但是运行时出现以下运行时错误。
RuntimeError: The classifier does not expose "coef_" or "feature_importances_" attributes
Run Code Online (Sandbox Code Playgroud)
如何克服这个问题并为模型选择最佳功能?如果不是,是否可以使用Scikit中RFE提供和支持的LogisticRegression()之类的算法来实现为数据集寻找最佳特征的任务?
feature-selection python-3.x scikit-learn deep-learning keras