Python 使用adaboost学习中的特征重要性

Python 使用adaboost学习中的特征重要性,python,classification,scikit-learn,Python,Classification,Scikit Learn,我正在学习唱歌。我正在使用adaboost分类器,希望确定哪些特征在分类中最重要。以下是我的代码: ada = AdaBoostClassifier(n_estimators=100) selector = RFECV(ada, step=1, cv=5) selector = selector.fit(np.asarray(total_data), np.asarray(target)) selector.support_ print "featue ranking", selecto

我正在学习唱歌。我正在使用adaboost分类器,希望确定哪些特征在分类中最重要。以下是我的代码:

ada =    AdaBoostClassifier(n_estimators=100)
selector = RFECV(ada, step=1, cv=5) 
selector = selector.fit(np.asarray(total_data), np.asarray(target))
selector.support_
print "featue ranking", selector.ranking_
我遇到以下错误:

 selector = selector.fit(np.asarray(total_data), np.asarray(target))
  File "C:\Python27\lib\site-packages\sklearn\feature_selection\rfe.py", line 336, in fit
    ranking_ = rfe.fit(X_train, y_train).ranking_
  File "C:\Python27\lib\site-packages\sklearn\feature_selection\rfe.py", line 148, in fit
    if estimator.coef_.ndim > 1:
AttributeError: 'AdaBoostClassifier' object has no attribute 'coef_'
有没有人对此有任何想法,以及如何纠正


谢谢

直接从
RFECV
的文档字符串:

Parameters
----------
estimator : object
    A supervised learning estimator with a `fit` method that updates a
    `coef_` attribute that holds the fitted parameters. Important features
    must correspond to high absolute values in the `coef_` array.

    For instance, this is the case for most supervised learning
    algorithms such as Support Vector Classifiers and Generalized
    Linear Models from the `svm` and `linear_model` modules.
换句话说,RFE目前仅针对线性模型实施。您可以将其更改为使用
feature\u importances\u
而不是
coef\u
并提交修补程序,从而使其适用于其他型号