mlr3learners / mlr3learners.lightgbm

Learners from {lightgbm} for mlr3
GNU Lesser General Public License v2.1
9 stars 3 forks source link

Prediction is crashed when restart r #16

Open nguyenngocbinh opened 3 years ago

nguyenngocbinh commented 3 years ago
library(mlr3)
library(mlr3learners.lightgbm)
task = mlr3::tsk("iris")
learner = mlr3::lrn("classif.lightgbm", objective = "multiclass")

learner$param_set$values = mlr3misc::insert_named(
  learner$param_set$values,
  list(
    "early_stopping_round" = 10,
    "learning_rate" = 0.1,
    "seed" = 17L,
    "metric" = "multi_logloss",
    "num_iterations" = 100,
    "num_class" = 3
  )
)

learner$train(task, row_ids = 1:120)
save(learner, task, file = "test_lightgbm.RData")

I restart Rstudio (press Ctrl + Shift + F10)

load library again

library(mlr3)
library(mlr3learners.lightgbm)
rm(list = ls())
load("test_lightgbm.RData")
predictions = learner$predict(task, row_ids = 121:150) # Crash in this  -----------