tests/testthat/test_single_variable.R

context("Check aggregate_profiles() function")

test_that("test plot",{

  selected_passangers <- select_sample(titanic_small, n = 100)
 cp_rf <- ceteris_paribus(explainer_rf, selected_passangers)

   pdp_rf <- aggregate_profiles(cp_rf, variables = "age")
  pl <- plot(cp_rf, variables = "age") +
     show_observations(cp_rf, variables = "age") +
     show_rugs(cp_rf, variables = "age", color = "red") +
     show_aggregated_profiles(pdp_rf, size = 2)

  expect_true("gg" %in% class(pl))
})

test_that("test ceteris_paribus",{

  selected_passangers <- select_sample(titanic_small, n = 100)
  cp_rf <- ceteris_paribus(explainer_rf, selected_passangers)
  pl <- plot(cp_rf, variables = "age") +
   show_observations(cp_rf, variables = "age") +
     show_rugs(cp_rf, variables = "age", color = "red")

  expect_true("gg" %in% class(pl))
})

Try the ingredients package in your browser

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

ingredients documentation built on Jan. 15, 2023, 5:09 p.m.