【问题标题】:how to use tune_nested() of mlr3tuning?如何使用 mlr3tuning 的 tune_nested()?
【发布时间】:2022-02-17 21:32:22
【问题描述】:
rm(list = ls())
library(mlr3verse)
task <- tsk(\"pima\")
learner <- lrn(\"classif.rpart\")
measure <- msr(\"classif.ce\")
inner_resample <- rsmp(\"cv\", folds = 5)
outer_resample <- rsmp(\"cv\", folds = 5)
search_space <- ps(
  cp = p_dbl(lower = 0.001, upper = 0.1)
)
rr <- tune_nested(
  method = \"grid_search\",
  resolution = 5,
  task = task,
  learner = learner,
  inner_resampling = inner_resample,
  outer_resampling = outer_resample,
  search_space = search_space,
  term_evals = 5
)

我总是收到这个错误:

Error in terminator_selection(term_evals, term_time) : 
  Assertion on \'term_evals\' failed: Must be of type \'single integerish value\' (or \'NULL\'), not \'ParamSet/R6\'.

我不知道我的代码有什么问题。有人可以给一些建议吗? 非常感谢。

    标签: mlr3


    【解决方案1】:

    你发现了一个错误。我们会解决这个问题。但是,如果您设置measure,它应该可以工作。

    library(mlr3verse)
    task <- tsk("pima")
    learner <- lrn("classif.rpart")
    measure <- msr("classif.ce")
    inner_resample <- rsmp("cv", folds = 5)
    outer_resample <- rsmp("cv", folds = 5)
    search_space <- ps(
      cp = p_dbl(lower = 0.001, upper = 0.1)
    )
    rr <- tune_nested(
      method = "grid_search",
      resolution = 5,
      task = task,
      learner = learner,
      inner_resampling = inner_resample,
      outer_resampling = outer_resample,
      measure = measure,
      search_space = search_space,
      term_evals = 5
    )
    

    【讨论】:

    • 天哪,这让我困惑了几天。希望你能尽快修复它。
    • 我还有另一个关于tunetune_nested 的问题,我如何在这两个函数中使用两个度量(多个度量)?谢谢您的回答。
    • 您是想优化两个度量(多标准优化)还是只优化一个度量(单一标准)并另外在第二个度量上对超参数配置进行评分?在后一种情况下,调谐器会忽略第二个度量,但您可以在存档中看到性能分数。
    • 该错误已在 GitHub 版本中修复。 CRAN 版本应该会在几个小时内上线。感谢您的报告。
    猜你喜欢
    • 2022-02-18
    • 1970-01-01
    • 2010-12-24
    • 1970-01-01
    • 1970-01-01
    • 2020-01-08
    • 2020-01-07
    • 1970-01-01
    • 2017-02-12
    相关资源
    最近更新 更多