模型参数的 JSON 字符串访问器
详细信息
请注意,赋值是在 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)