我正在使用 scikit 的递归特征消除来摆脱一些特征。
使用直接RFE时,我可以将步骤设置为浮点数,这意味着(例如)每一步都应该消除 10% 的特征。它运作良好。
切换到RFECV时,这似乎不起作用。
代码示例(适用于RFE并与RFECV失败):
from sklearn.feature_selection import RFECV
selector = RFECV(model_classifier, step=0.1, cv=3,
scoring='roc_auc', verbose=10, n_jobs=-1)
selector.fit(X_train, y_train)
症状:
过程永无止境地进行下去。
似乎没有内核激活。
标准输出打印:
... lib/python3.4/site-packages/sklearn/feature_selection/rfe.py:198: DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future support_[features[ranks][:threshold]] = False
标准输出也打印:(
Fitting estimator with 177 features. Fitting estimator with 177 features. Fitting estimator with 177 features. Fitting estimator with 124 features. Fitting estimator with 124 features. Fitting estimator with 71 features. Fitting estimator with 71 features. Fitting estimator with 124 features. Fitting estimator with 18 features. Fitting estimator with 18 features. Fitting estimator with 71 features. Fitting estimator with 18 features.
但实际上什么也没发生)适用于整数步长