ModelOriented / ingredients

Effects and Importances of Model Ingredients
https://modeloriented.github.io/ingredients/
GNU General Public License v3.0
37 stars 19 forks source link

[plot CP] auto change the color parameter to '_label_' with multiple models (more than 1 unique label) #123

Closed hbaniecki closed 4 years ago

hbaniecki commented 4 years ago

from: https://github.com/ModelOriented/DALEX/issues/236

pbiecek commented 4 years ago

tested with

library("DALEX")
library("ingredients")
library("randomForest")

model_titanic_rf <- randomForest(survived ~ gender + age + fare,
                        data = na.omit(titanic_imputed))
explain_titanic_rf <- explain(model_titanic_rf,
                              data = titanic_imputed[,-8],
                              y = titanic_imputed[,8],
                              verbose = FALSE)
model_titanic_glm <- glm(survived ~ gender + age + fare,
                         data = titanic_imputed, family = "binomial")

explain_titanic_glm <- explain(model_titanic_glm,
                               data = titanic_imputed[,-8],
                               y = titanic_imputed[,8],
                               verbose = FALSE)

cp1 <- ceteris_paribus(explain_titanic_rf, titanic_imputed[c(1,100),])
cp2 <- ceteris_paribus(explain_titanic_glm, titanic_imputed[c(1,100),])
plot(cp1, cp2)
plot(cp1)
hbaniecki commented 4 years ago

Thanks