Go directly to the code!
# 在训练集上训练一个监督学习模型
model = AdaBoostClassifier(base_estimator=DecisionTreeClassifier(max_depth=3),n_estimators=8)
model.fit(X_train,y_train)
# 提取特征重要性
importances = model.feature_importances_
# 绘图
vs.feature_plot(importances, X_train, y_train)
Models such as AdaBoost and Random Forest have the attribute of'feature_importance_', which mainly rank the importance of features.