inst/paramtest/test_paramtest_classif.naive_bayes.R

library(mlr3learners)

test_that("classif.naive_bayes", {
  learner = lrn("classif.naive_bayes")
  fun = list(e1071::naiveBayes, e1071:::naiveBayes.default)
  exclude = c(
    "x", # handled via mlr3
    "y" # handled via mlr3
  )

  ParamTest = run_paramtest(learner, fun, exclude, tag = "train")
  expect_true(
    ParamTest,
    info = paste0(
      "\nMissing parameters in mlr3 param set:\n",
      paste0("- ", ParamTest$missing, "\n", collapse = ""),
      "\nOutdated param or param defined in additional control function not in list of function definitions:\n",
      paste0("- ", ParamTest$extra, "\n", collapse = "")
    )
  )
})

test_that("predict classif.naive_bayes", {
  learner = lrn("classif.naive_bayes")
  fun = e1071:::predict.naiveBayes
  exclude = c(
    "object", # handled via mlr3
    "newdata", # handled via mlr3
    "type" # handled via mlr3
  )

  ParamTest = run_paramtest(learner, fun, exclude, tag = "predict")
  expect_true(
    ParamTest,
    info = paste0(
      "\nMissing parameters in mlr3 param set:\n",
      paste0("- ", ParamTest$missing, "\n", collapse = ""),
      "\nOutdated param or param defined in additional control function not in list of function definitions:\n",
      paste0("- ", ParamTest$extra, "\n", collapse = "")
    )
  )
})

Try the mlr3learners package in your browser

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

mlr3learners documentation built on June 9, 2026, 5:07 p.m.