tests/testthat/test_tune_getTuneResultOptPath.R

test_that("getTuneResultOptPath", {
  ctrl = makeTuneControlRandom(maxit = 3L)
  rdesc = makeResampleDesc("CV", iters = 3L)
  ps = makeParamSet(
    makeDiscreteParam("C", values = seq(1:10)))
  rdesc = makeResampleDesc("CV", iters = 3L)
  res = tuneParams("classif.ksvm", task = iris.task, resampling = rdesc,
    par.set = ps, control = ctrl)

  expect_equal(res$opt.path, getTuneResultOptPath(res, as.df = FALSE))
  expect_equal(as.data.frame(res$opt.path), getTuneResultOptPath(res))
})
mlr-org/mlr documentation built on Jan. 12, 2023, 5:16 a.m.