library("DALEX")
library("ingredients")
library("ranger")
# \donttest{
model_titanic_rf <- ranger(survived ~., data = titanic_imputed, probability = TRUE)
explain_titanic_rf <- explain(model_titanic_rf,
data = titanic_imputed[,-8],
y = titanic_imputed[,8],
label = "ranger forest",
verbose = FALSE)
selected_passangers <- select_sample(titanic_imputed, n = 10)
cp_rf <- ceteris_paribus(explain_titanic_rf, selected_passangers)
plotD3(cp_rf, variables = c("age","parch","fare","sibsp"),
facet_ncol = 2, scale_plot = TRUE)
selected_passanger <- select_sample(titanic_imputed, n = 1)
cp_rf <- ceteris_paribus(explain_titanic_rf, selected_passanger)
plotD3(cp_rf, variables = c("class", "embarked", "gender", "sibsp"),
facet_ncol = 2, variable_type = "categorical", label_margin = 100, scale_plot = TRUE)
# }
Run the code above in your browser using DataLab