小编dat*_*imp的帖子

如何计算xgboost封面?

有人可以解释如何在函数中计算R包中的Cover列吗?xgboostxgb.model.dt.tree

在文档中,它说Cover "是衡量受分割影响的观察数量的指标".

当您运行xgboost此函数的文档中给出的以下代码时,Cover树0的节点0为1628.2500.

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

#Both dataset are list with two items, a sparse matrix and labels
#(labels = outcome column which will be learned).
#Each column of the sparse Matrix is a feature in one hot encoding format.
train <- agaricus.train

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

#agaricus.test$data@Dimnames[[2]] represents the column names of …
Run Code Online (Sandbox Code Playgroud)

r xgboost

12
推荐指数
1
解决办法
3761
查看次数

如何计算xgboost质量?

有人可以解释如何Qualityxgb.model.dt.tree函数中计算xgboost R包中的列吗?

在文档中,它说Quality"是与此特定节点中的拆分相关的增益".

当您运行以下代码时,在此函数的xgboost文档中给出,Quality对于树0的节点0是4000.53,但我计算Gain 为2002.848

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

    train <- agarics.train

    X = train$data
    y = train$label

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

    xgb.model.dt.tree(agaricus.train$data@Dimnames[[2]], model = bst)

    p = rep(0.5,nrow(X))

    L = which(X[,'odor=none']==0)
    R = which(X[,'odor=none']==1)

    pL = p[L]
    pR = p[R]

    yL = y[L]
    yR = y[R]

    GL = sum(pL-yL)
    GR = sum(pR-yR)
    G = …
Run Code Online (Sandbox Code Playgroud)

r xgboost

12
推荐指数
1
解决办法
2111
查看次数

标签 统计

r ×2

xgboost ×2