tests/testthat/test-predictions.R

context("test-predictions")

test_that("get_important_variables", {
  #df <- tibble::tibble(x = c(1, 2, NA), y = c(1.5, 2, 3.5))
  #mod <- lm(y ~ x, data = df)
  #out <- add_predictions(df, mod)
  
  out1 = get_important_variables(model)
  out2 = get_important_variables(model, plot = TRUE)
  
  expect_equal(2 * 2, 4)
})


test_that("get_confusion_matrix", {
  
  out = get_confusion_matrix(dta, TARGET1, PREDICTED)
  
  expect_equal(2 * 2, 4)
})

test_that("plot_distribution", {
  plot_distribution(dta,
                    NULL,
                    "VAR1",
                    "VAR2",
                    "VAR3",
                    "VAR4")

  plot_distribution(dta,
                    "TARGET1",
                    "VAR1",
                    "VAR2",
                    "VAR3",
                    "VAR4")
  
  expect_equal(2 * 2, 4)
})
ldanai/tidymodel documentation built on Jan. 4, 2020, 6:25 a.m.