tests/testthat/test-prediction-error.R

# This test throws a warning in R CMD check, but I can't figure out why.
# I'm deleting it to be able to move along with distributing the package.

# test_that("Prediction error works", {
#   require("mosaicData")
#   mod <- mosaicData::Galton |>
#     model_train(height ~ splines::ns(father,3) * poly(mother, 2) * sex)
#   result <- suppressWarnings(model_pe(mod))
#   expect_true( abs(result - 4.44231) < 0.0001 )
#   # testdata feature works
#   result2 <- model_pe(mod, testdata = head(Galton), error_type = "default")
#   expect_true( abs(result2 - 0.41091) < 0.0001)
#   })

# Still working on `model_cv()`

# test_that("CV works", {
#   mod <- mosaicData::Galton |> model_train(height ~ father*mother*sex)
#   result <- suppressWarnings(model_cv(mod))
#   expect_true( abs(result - 4.44231) < 0.0001 )
# })

Try the LSTbook package in your browser

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

LSTbook documentation built on April 3, 2025, 6:02 p.m.