ModelOriented / ingredients

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

Use data y_hat mean centering in ale plot #126

Closed hbaniecki closed 3 years ago

hbaniecki commented 3 years ago

E.g. centering depends on variables.

library("DALEX")
library("ranger")
titanic_ranger_model <- ranger(survived~., data = titanic_imputed, num.trees = 50,
                               probability = TRUE)
explainer_ranger  <- explain(titanic_ranger_model, data = titanic_imputed)
mp1 <- model_profile(explainer_ranger, variables='sibsp', type='accumulated', N=3000)
mean(mp1$cp_profiles$`_yhat_`, na.rm = TRUE)
mean(mp1$agr_profiles$`_yhat_`, na.rm = TRUE)
mp2 <- model_profile(explainer_ranger, type='accumulated', N=3000)
mean(mp2$cp_profiles$`_yhat_`, na.rm = TRUE)
mean(mp2$agr_profiles$`_yhat_`, na.rm = TRUE)
plot(mp1)
plot(mp2, variables='sibsp')