search - xgboost:处理拆分候选搜索的遗漏值

标签 search split missing-data xgboost candidate

their article的3.4节中,作者解释了当搜索树木生长的最佳候选分割时如何处理缺失值。具体来说,它们为这些节点创建默认方向,这些默认节点具有拆分功能,即在当前实例集中缺少值的节点。在预测时,如果预测路径经过此节点并且缺少要素值,则遵循默认方向。

但是,如果缺少要素值并且节点没有默认方向(在许多情况下可能会发生),则预测阶段将破裂。换句话说,它们如何将默认方向关联到所有节点,即使是在训练时在事件实例集中具有无缺失拆分功能的节点也是如此?

最佳答案

xgboost始终会考虑缺少值的分割方向,即使没有训练也是如此。默认值为分割条件中的yes方向。然后了解训练中是否存在

来自作者 link

enter image description here

可以通过以下代码来观察

    require(xgboost)

    data(agaricus.train, package='xgboost')

    sum(is.na(agaricus.train$data))
    ##[1] 0  

    bst <- xgboost(data = agaricus.train$data, 
                       label = agaricus.train$label, 
                       max.depth = 4, 
                       eta = .01, 
                       nround = 100,
                       nthread = 2, 
                       objective = "binary:logistic")

dt <- xgb.model.dt.tree(model = bst)  ## records all the splits 

> head(dt)
     ID Feature        Split  Yes   No Missing      Quality   Cover Tree Yes.Feature Yes.Cover  Yes.Quality
1:  0-0      28 -1.00136e-05  0-1  0-2     0-1 4000.5300000 1628.25    0          55    924.50 1158.2100000
2:  0-1      55 -1.00136e-05  0-3  0-4     0-3 1158.2100000  924.50    0           7    679.75   13.9060000
3: 0-10    Leaf           NA   NA   NA      NA   -0.0198104  104.50    0          NA        NA           NA
4: 0-11       7 -1.00136e-05 0-15 0-16    0-15   13.9060000  679.75    0        Leaf    763.00    0.0195026
5: 0-12      38 -1.00136e-05 0-17 0-18    0-17   28.7763000   10.75    0        Leaf    678.75   -0.0199117
6: 0-13    Leaf           NA   NA   NA      NA    0.0195026  763.00    0          NA        NA           NA
   No.Feature No.Cover No.Quality
1:       Leaf   104.50 -0.0198104
2:         38    10.75 28.7763000
3:         NA       NA         NA
4:       Leaf     9.50 -0.0180952
5:       Leaf     1.00  0.0100000
6:         NA       NA         NA

> all(dt$Missing == dt$Yes,na.rm = T)
[1] TRUE

源代码
https://github.com/tqchen/xgboost/blob/8130778742cbdfa406b62de85b0c4e80b9788821/src/tree/model.h#L542

关于search - xgboost:处理拆分候选搜索的遗漏值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37617390/

相关文章:

algorithm - 根据姓名、DoB、地址等匹配人员

java正则表达式,同时在括号上拆分字符串

php - 在不同的字符出现处将字符串转换为数组

r - 如何从因子变量(和 ggplot 图表)中删除 NA?

python - 有没有办法在 Pandas DataFrame 的列中查找模式

git - Git 存储库中缺少文件

python - 如何存储搜索结果以进行本地化

php - 按条件搜索,使用elastica给出空结果

Java:在字符串中查找字符串

string - PowerShell 中的 .split 对我不起作用有什么原因吗?