将模型参数作为 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)