# \donttest{
library(lightgbm)
setLGBMthreads(2L)
data.table::setDTthreads(1L)
data("agaricus.train")
model <- lightgbm(
agaricus.train$data
, agaricus.train$label
, params = list(objective = "binary")
, nrounds = 5L
, verbose = 0
, num_threads = 2L
)
fname <- tempfile(fileext="rds")
saveRDS(model, fname)
model_new <- readRDS(fname)
model_new$check_null_handle()
lgb.restore_handle(model_new)
model_new$check_null_handle()
# }
Run the code above in your browser using DataLab