Has anyone an efficient way to serialize and save the R6 class objects produced by the resample()
function in the mlr3
package? Using saveRDS()
doesn't seem to work as it takes forever. Googling suggested that serialization of the R6 objects in the problem. I saw a post from 2020 that points out this issue but doesn't seem solve it (https://github.com/mlr-org/mlr3/issues/482). So i'm wondering if anyone managed to efficiently save these objects, especially when store_models=T
for the learners?
Please see some sample code below. I don't have the task object defined, but i'm assuming any task will do.
glmnetBasic <- lrn("classif.glmnet", predict_type = "prob", predict_sets=c("train","test"))
glmnetAT = auto_tuner(
method = tnr("random_search", batch_size = 4L),
learner = glmnetBasic,
resampling = rsmp("cv", folds = 5),
search_space = lts("classif.glmnet.default"),
measure = msr("classif.bacc"),
terminator = trm("evals", n_evals = 100L), store_models=T)
outer_resampling = rsmp("subsampling", repeats = 100, ratio = 0.8)
future::plan(list("multisession", "sequential"))
time1 <- Sys.time(); set.seed(796343)
rr1= resample(task1, glmnetAT , resampling=outer_resampling, store_models = TRUE)
Sys.time() - time1
saveRDS(rr1, "fileName.rds")