tests/testthat/test_plot_ceteris_paribus_oscillations.R

context("Check plot_ceteris_paribus_oscillations() function")

library("DALEX2")
library("randomForest")
set.seed(59)
apartmentsTest <- apartments_test

apartments_rf_model <- randomForest(m2.price ~ construction.year + surface + floor +
      no.rooms + district, data = apartments)
explainer_rf <- explain(apartments_rf_model,
      data = apartmentsTest, y = apartmentsTest$m2.price)

apartment <- apartmentsTest[1:2,]

cp_rf <- individual_variable_profile(explainer_rf, apartment)
vips <- individual_variable_oscillations(cp_rf)

test_that("Output format - plot_ceteris_paribus_oscillations",{
  expect_is(plot(vips), "ggplot")
})
pbiecek/ceterisParibus2 documentation built on Sept. 16, 2019, 6:26 p.m.