library("DALEX")
library("ingredients")
# \donttest{
library("ranger")
rf_model <- ranger(survived ~., data = titanic_imputed, probability = TRUE)
explainer_rf <- explain(rf_model,
data = titanic_imputed[,-8],
y = titanic_imputed[,8],
label = "ranger forest",
verbose = FALSE)
selected_passangers <- select_sample(titanic_imputed, n = 100)
cp_rf <- ceteris_paribus(explainer_rf, selected_passangers)
cp_rf
plot(cp_rf, variables = "age", color = "grey") +
show_observations(cp_rf, variables = "age", color = "black") +
show_rugs(cp_rf, variables = "age", color = "red")
# }
Run the code above in your browser using DataLab