select python 中 Adaboost 的重要特征

select Important-feature with Adaboost in python

我想 select adaboost 的重要功能。我发现 'yellowbrick.model_selection' 对于这项工作非常好而且很快。我使用了这段代码。但它有问题。 “ValueError:无法将形状 (260200) 中的输入数组广播到形状 (1)
我的特征向量对于每个图像都有 1*260200。我无法理解 adaboost 是如何制作模型的,所以我无法调试代码。 你能帮帮我吗? 非常感谢:)

   from sklearn.ensemble import AdaBoostClassifier
   from yellowbrick.model_selection import FeatureImportances

    model = AdaBoostClassifier(n_estimators=10, random_state=1)
    model.fit(X_train, Y_train)
    visualizer = FeatureImportances(model)
    visualizer.show()

这段代码,对每个特征进行排序

from sklearn.ensemble import AdaBoostClassifier

ab_model = AdaBoostClassifier(n_estimators=20,random_state=0)
ab_model.fit(x_train, y_train)
importances = ab_model.feature_importances_
non_zero=np.nonzero(importances)

non_zero是一个表示重要特征U指数的向量。 好卢克