feature_importances_提取特征重要性的应用

直接上代码!

# 在训练集上训练一个监督学习模型
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)

AdaBoost,随机森林等模型具有’feature_importance_’ 属性,主要是对特征的重要性排序。

猜你喜欢

转载自blog.csdn.net/weixin_45281949/article/details/102809122
今日推荐