File: test_classif_clusterSVM.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 (28 lines) | stat: -rwxr-xr-x 804 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

test_that("classif_clusterSVM", {
  requirePackagesOrSkip("SwarmSVM", default.method = "load")

  parset.list1 = list(
    list(centers = 2),
    list(centers = 3, seed = 0)
  )

  parset.list2 = list(
    list(),
    list(centers = 3, seed = 0)
  )

  old.predicts.list = list()

  for (i in seq_along(parset.list1)) {
    parset = parset.list1[[i]]
    pars = list(data.matrix(binaryclass.train[, -61]), y = binaryclass.train[, 61])
    pars = c(pars, parset)
    set.seed(getOption("mlr.debug.seed"))
    m = suppressMessages(do.call(SwarmSVM::clusterSVM, pars))
    old.predicts.list[[i]] = predict(m, data.matrix(binaryclass.test[, -61]))$predictions
  }

  testSimpleParsets("classif.clusterSVM", binaryclass.df, binaryclass.target,
    binaryclass.train.inds, old.predicts.list, parset.list2)
})