# NOT RUN {
library("DALEX")
model_titanic_glm <- glm(survived == 1 ~
class+gender+age+sibsp+parch+fare+embarked,
data = titanic_imputed,
family = "binomial")
explain_titanic_glm <- explain(model_titanic_glm,
data = titanic_imputed[,-8],
y = titanic_imputed$survived == 1,
verbose = FALSE)
aspects <- list(wealth = c("class", "fare"),
family = c("sibsp", "parch"),
personal = c("gender", "age"),
embarked = "embarked")
aspect_importance(explain_titanic_glm,
new_observation = titanic_imputed[1,],
aspects = aspects)
# }
# NOT RUN {
library("randomForest")
model_titanic_rf <- randomForest(survived ~ class + gender + age + sibsp +
parch + fare + embarked,
data = titanic_imputed)
explain_titanic_rf <- explain(model_titanic_rf,
data = titanic_imputed[,-8],
y = titanic_imputed$survived == 1,
verbose = FALSE)
aspect_importance(explain_titanic_rf,
new_observation = titanic_imputed[1,],
aspects = aspects)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab