r - xgb.plot.multi.trees 括号里的数字是什么意思?
问题描述
这不是树的数量,因为我只训练了 25 棵树。它也不是变量的值。括号中值的比例很明显,这是没有意义的,因为记录了许多变量。我检查了文档,没有任何解释。有什么想法或其他参考吗?
df1 <- xgb.train(data = X_train_dmat,
eta = 0.1,
max_depth = 5,
nround=25,
subsample = 0.5,
colsample_bytree = 0.5,
booster = 'gbtree',
objective = 'reg:squarederror',
nthread = 3
)
xgb.plot.multi.trees(model = df1,
features_keep = 5,
use.names=FALSE,
plot_width = NULL,
plot_height = NULL,
render = TRUE
)
解决方案
查看源代码https://github.com/dmlc/xgboost/blob/master/R-package/R/xgb.plot.multi.trees.R#L94,这是在树中创建节点的部分:
nodes.dt <- tree.matrix[
, .(Quality = sum(Quality))
, by = .(abs.node.position, Feature)
][, .(Text = paste0(Feature[1:min(length(Feature), features_keep)],
" (",
format(Quality[1:min(length(Quality), features_keep)], digits=5),
")") %>%
paste0(collapse = "\n"))
, by = abs.node.position]
具体来说,这是编写这些数字的代码:
format(Quality[1:min(length(Quality), features_keep)], digits=5)
因此,这些数字显示了每个节点的质量,我认为这反映了该节点划分数据的适当程度。自从我处理这些模型以来已经有一段时间了,而且我从来没有精明过,所以我不能确定我的解释。如果您想进一步解释质量的含义,您可以深入挖掘源代码以弄清楚它是如何计算的。
推荐阅读
- android - 在 Termux Android 上连接到 MariaDB 服务器
- xml - 如何使用 Golang 在 XML 中获取更深层次元素的元素名称
- c# - 在 Bamboo 上使用 MSBuild 构建解决方案时遇到问题
- reactjs - 添加多重排序
- c# - 在哪里处理 DataGridView 格式错误
- laravel - 无法使用 SMTP(数字海洋)在 laravel 中发送邮件,并且在发送邮件时收到通知。但收件人没有收到邮件
- sql - 从另一个表插入到 SELECT MAX
- python - pytest - 测试流顺序
- typo3-7.6.x - TYPO3 未在前端显示图像 - 常规内容元素和 ext:news
- image - 具有某些路径类型的图像不会显示在我的 webgl 应用程序中