what_if {ceterisParibus} | R Documentation |
What-If Plot
Description
What-If Plot
Usage
what_if(explainer, observation, grid_points = 101, selected_variables = NULL)
Arguments
explainer |
a model to be explained, preprocessed by the 'DALEX::explain' function |
observation |
a new observarvation for which predictions need to be explained |
grid_points |
number of points used for response path |
selected_variables |
if specified, then only these variables will be explained |
Value
An object of the class 'what_if_explainer'. It's a data frame with calculated average responses.
Examples
library("DALEX")
## Not run:
library("randomForest")
set.seed(59)
apartments_rf_model <- randomForest(m2.price ~ construction.year + surface + floor +
no.rooms + district, data = apartments)
explainer_rf <- explain(apartments_rf_model,
data = apartmentsTest[,2:6], y = apartmentsTest$m2.price)
new_apartment <- apartmentsTest[1, ]
new_apartment
wi_rf <- what_if(explainer_rf, observation = new_apartment)
wi_rf
wi_rf <- what_if(explainer_rf, observation = new_apartment,
selected_variables = c("surface", "floor", "no.rooms"))
wi_rf
## End(Not run)
[Package ceterisParibus version 0.4.2 Index]