Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learner has not been trained yet #30

Open
MislavSag opened this issue May 9, 2024 · 0 comments
Open

Learner has not been trained yet #30

MislavSag opened this issue May 9, 2024 · 0 comments

Comments

@MislavSag
Copy link

I have trained models using mlr3batchmark package:

  # Exp dir
  date_ = strftime(Sys.time(), format = "%Y%m%d")
  dirname_ = glue("experiments_pread_live_{date_}")
  if (dir.exists(dirname_)) system(paste0("rm -r ", dirname_))

  # Create registry
  packages = c("data.table", "gausscov", "paradox", "mlr3", "mlr3pipelines",
               "mlr3tuning", "mlr3misc", "future", "future.apply",
               "mlr3extralearners", "stats")
  reg = makeExperimentRegistry(file.dir = dirname_, seed = 1, packages = packages)
  
  # Populate registry with problems and algorithms to form the jobs
  batchmark(designs, store_models = TRUE, reg = reg)
  
  # Save registry
  saveRegistry(reg = reg)

  # get nondone jobs
  ids = findNotDone(reg = reg)
  
  # set up cluster (for local it is parallel)
  cf = makeClusterFunctionsSocket(ncpus = 4L)
  reg$cluster.functions = cf
  saveRegistry(reg = reg)
  
  # define resources and submit jobs
  resources = list(ncpus = 2, memory = 8000)
  submitJobs(ids = ids$job.id, resources = resources, reg = reg)

When I load models after the training:

  results = reduceResultsBatchmark(reg = reg, store_backends = TRUE)
  
  # predictions for new dataset
  task_new = task$clone()
  task_new$filter(rows = data_ids)
  results$learners$learner[[1]]$predict(task = task_new)

I get an error

Error: Cannot predict, Learner 'filter_target_branch.nop_filter_target.filter_target_id.filter_target_unbranch.subsample.dropnacol.dropna.removeconstants_1.fixfactors.winsorizesimple.removeconstants_2.dropcorr.scale_branch.uniformization.scale.scale_unbranch.dropna_v2.nop_union_pca.pca.ica.feature_union_pca.disr.jmim.jmi.mim.mrmr.njmim.cmim.carscore.information_gain.relief.gausscov_f1st.feature_union_filters.removeconstants_3.regr.ranger.tuned' has not been trained yet

It returns an error like the model is not saved, even if I set I want to save it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant