【发布时间】:2018-10-16 09:00:15
【问题描述】:
我试图找到主导我的回归模型输出的最佳特征,以下是我的代码。
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)
但运行时出现以下运行时错误。
RuntimeError: The classifier does not expose "coef_" or "feature_importances_" attributes
如何克服这个问题并为我的模型选择最佳功能?如果没有,我可以使用 Scikit 中 RFE 提供和支持的 LogisticRegression() 等算法来完成为我的数据集寻找最佳特征的任务吗?
【问题讨论】:
标签: python-3.x scikit-learn deep-learning keras feature-selection