为什么 xgboost 显示最后一棵树中未显示的具有重要特征的特征?
Why xgboost show features of feature importance which doen't shown in last tree?
我的数据集有 7 个特征。
我是 运行 xgboost
并绘制了最后一棵树:
plot_tree(model, num_trees = model.n_estimators-1)
- 最后一棵树只包含 2 个特征。
- 据我了解,最后一棵树(树编号 = n_estimators-1)是用于预测的树(也是唯一用于预测的树)。
我正在绘制特征重要性:
plot_importance(model)
- 该图有 7 个特征
- 为什么我们看到全部 7 个特征而不是 2 个特征? (我问是因为最后一棵树使用了 2 个特征而不是 7 个特征)。
- 据我了解,特征重要性需要根据最后一棵树来计算,是这样吗? (因为这棵树用于预测)?
xgboost 使用所有树进行预测。 (每个树叶都会为最终预测添加一些值)因此你看到了 7 个特征。
我建议您观看有关 xgboost 工作原理的视频教程:
XGBoost Part 2 (of 4): Classification
我的数据集有 7 个特征。
我是 运行 xgboost
并绘制了最后一棵树:
plot_tree(model, num_trees = model.n_estimators-1)
- 最后一棵树只包含 2 个特征。
- 据我了解,最后一棵树(树编号 = n_estimators-1)是用于预测的树(也是唯一用于预测的树)。
我正在绘制特征重要性:
plot_importance(model)
- 该图有 7 个特征
- 为什么我们看到全部 7 个特征而不是 2 个特征? (我问是因为最后一棵树使用了 2 个特征而不是 7 个特征)。
- 据我了解,特征重要性需要根据最后一棵树来计算,是这样吗? (因为这棵树用于预测)?
xgboost 使用所有树进行预测。 (每个树叶都会为最终预测添加一些值)因此你看到了 7 个特征。
我建议您观看有关 xgboost 工作原理的视频教程: XGBoost Part 2 (of 4): Classification