tests/testthat/test_base_resample_weights.R

test_that("resample works with weights", {
  task = makeClassifTask(data = iris, target = "Species", weights = as.integer(iris$Species))
  res = resample(task = task, learner = "classif.rpart", resampling = makeResampleDesc("CV", iters = 2))
  expect_s3_class(res$pred, "ResamplePrediction")
})

Try the mlr package in your browser

Any scripts or data that you put into this service are public.

mlr documentation built on Sept. 29, 2022, 5:05 p.m.