【问题标题】:Is the number in RFECV gridscore equivalent to the selected features?RFECV gridscore 中的数字是否等同于所选特征?
【发布时间】:2020-12-25 20:03:23
【问题描述】:

我正在寻求有关 RFECV 中与 selector.grid_scores_ 关联的数字的一些说明。

我用过以下:

from sklearn.feature_selection import RFECV

estimator_RFECV = ExtraTreesClassifier(random_state=0)
estimator_RFECV = RFECV(estimator_RFECV, min_features_to_select = 20, step=1, cv=5, scoring='accuracy', verbose=1, n_jobs=-1)
estimator_RFECV = estimator_RFECV.fit(X_train, y_train)

使用estimator_RFECV.ranking_,通过CV选择了27个特征,但是,当我查看estimator_RFECV.grid_scores_时,在27处,这里的值(准确度)并不是最高的。我是否对 grid_scores_ 的解释不正确,我不应该期望 27 的准确度最高?

【问题讨论】:

    标签: pandas computer-vision classification rfe


    【解决方案1】:
    1. 这里,estimator_RFECV.ranking_会给你一个特征排名数组,这样ranking_[i]对应第i个特征的排名位置。选定(即估计的最佳)特征被分配到第 1 级,第 2 级的特征将不如第 1 级重要,依此类推。

    所以 estimator_RFECV.ranking_ 会给我们特征的排名,或者我们可以说特征的各自重要性。

    1. 但是,estimator_RFECV.grid_scores_ 将根据评分指标、min_features_to_select 和最大可用特征数为我们提供数组。在上述情况下,它应该包含 8 个元素,每个元素代表具有前 X 个特征的准确度,其中 X 属于 20 到 27。

    是的,特征数量较少的模型总是有可能具有更高的准确度,因为我们可能认为一些不相关的特征。

    此外,官方文档中的RFECV documentation 链接可能会有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-05-28
      • 1970-01-01
      • 2015-10-29
      • 2016-08-31
      • 2020-04-16
      • 1970-01-01
      • 2021-08-09
      • 2019-06-04
      • 2018-12-13
      相关资源
      最近更新 更多