tests/testthat/test_pmml.iForest.R

test_that("error when object is not iForest", {
  expect_error(pmml.iForest("foo"), "Not a legitimate iForest object")
})

test_that("confirm non-existent category is still automatically created by iForest function", {
  skip_on_cran()
  # skip_on_ci()

  skip_if_not_installed("isofor")
  library(isofor)

  data(iris)

  mod <- iForest(iris, nt = 2, phi = 30)
  model_pmml <- pmml(model = mod)
  expect_equal(length(model_pmml[[2]]), 5)
  expect_equal(as.character(model_pmml[[2]][[5]][[4]])[2], ".")
})

Try the pmml package in your browser

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

pmml documentation built on March 18, 2022, 5:49 p.m.