File: test_base_train.R

package info (click to toggle)
r-cran-mlr 2.19.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,392 kB
  • sloc: ansic: 65; sh: 13; makefile: 5
file content (12 lines) | stat: -rwxr-xr-x 409 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12

test_that("train works with subset", {
  subs = 1:5
  mod = train("classif.rpart", binaryclass.task, subset = subs)
  expect_equal(mod$subset, subs)
  expect_equal(length(mod$learner.model$y), length(subs))

  subs = c(TRUE, FALSE, TRUE, TRUE)
  mod = train("classif.rpart", binaryclass.task, subset = subs)
  expect_equal(mod$subset, c(1L, 3L, 4L))
  expect_equal(length(mod$learner.model$y), sum(subs))
})