跳到内容

模型参数的 JSON 字符串访问器

用法

xgb.config(object)

xgb.config(object) <- value

参数

对象

xgb.Booster 类的对象。赋值时将在原位修改

value

一个列表。

参数以列表形式表示。

详细信息

请注意,赋值是在 booster C 对象上进行的原位操作,与 R 属性的赋值不同,它不遵循典型的写时复制(copy-on-write)赋值语义——即,对同一 booster 的所有引用也将被更新。

有关此行为的示例,请参见 xgb.copy.Booster()

示例

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

## Keep the number of threads to 1 for examples
nthread <- 1
data.table::setDTthreads(nthread)
train <- agaricus.train

bst <- xgb.train(
  data = xgb.DMatrix(train$data, label = train$label, nthread = 1),
  nrounds = 2,
  params = xgb.params(
    max_depth = 2,
    nthread = nthread,
    objective = "binary:logistic"
  )
)

config <- xgb.config(bst)