3

训练学习者后,将最终模型保存在哪里mlr3--- learner$train(data)?通过“最终模型”,我的意思是类似于由以下代码生成的列表:

model <- xgboost::xgb.train(data = data_train, 
                                   max.depth = 8, nthread = 2, nrounds = 15,
                                   verbose = 0)  

有没有办法提取这个列表/对象?


task <- TaskRegr$new("data", data, "y")
learner <- lrn("regr.xgboost")
preprocess <- po("scale", param_vals = list(center = TRUE, scale = TRUE))
pp <- preprocess %>>% learner
gg<- GraphLearner$new(pp)
gg$train(task)
4

1 回答 1

4

在 xgboost 中,“模型”存储为:

model <- xgboost::xgb.train(data = data_train, 
                                   max.depth = 8, nthread = 2, nrounds = 15,
                                   verbose = 0)

在 MLR3 中,当使用以下方法进行训练时:

task <- TaskRegr$new("data", data, "y")
learner <- lrn("regr.xgboost")
preprocess <- po("scale", param_vals = list(center = TRUE, scale = TRUE))
pp <- preprocess %>>% learner
gg<- GraphLearner$new(pp)
gg$train(task)

等效于“模型”存储为

gg$model$regr.xgboost$model
于 2020-11-07T02:27:33.900 回答