1

Hopefully a simple question but incredibly annoying lack of information in the mlr3 book! So I have a tuned learner (regr.bart) that I want to simply set one hyperparameter to a fixed (not tuned) value. The param in question is 'verbose' which annoyingly is set to TRUE so I get flooded with stupid messages I do not want. I cannot find a simple example where I can set verbose to FALSE. Please help.

1 Answer 1

3
library(mlr3tuning)

learner = lrn("classif.rpart", cp = to_tune(0.001, 0.1), keep_model = FALSE)

tune(
  method = "random_search",
  task = tsk("pima"),
  learner = learner,
  resampling = rsmp("cv", folds = 3),
  measure = msr("classif.ce"),
  term_evals = 10,
  batch_size = 5
)

or

library(mlr3tuning)

search_space = ps(
  cp = p_dbl(lower = 0.001, upper = 0.1)
)

learner = lrn("classif.rpart")

learner$param_set$values$keep_model = FALSE

tune(
  method = "random_search",
  task = tsk("pima"),
  learner = learner,
  resampling = rsmp("cv", folds = 3),
  measure = msr("classif.ce"),
  term_evals = 10,
  search_space = search_space,
  batch_size = 5
)
Sign up to request clarification or add additional context in comments.

1 Comment

Is there a way to assign the search_space ParamSet to the learner directly, rather than having it as an argument within tune()? I've tried learner$param_set$set_values(search_space) and wanted a list object, not a ParamSet object

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.