ModelOriented / iBreakDown

Break Down with interactions for local explanations (SHAP, BreakDown, iBreakDown)
https://ModelOriented.github.io/iBreakDown/
GNU General Public License v3.0
81 stars 15 forks source link

bug in plotting distributions on R3.6 #90

Closed hbaniecki closed 3 years ago

hbaniecki commented 3 years ago

It occurs when the variable column is a factor instead of character (default for R3.6, changed in R4.0).

library(DALEX)
model_lm <- lm(m2.price~., data = apartments)
explainer_lm <- DALEX::explain(model_lm, data = apartments, y = apartments$m2.price)
mp <- iBreakDown::local_attributions(explainer_lm, apartments[3,], keep_distributions=TRUE)

mp$variable <- as.factor(mp$variable)

plot(mp, plot_distributions = TRUE)

image

Potential fix: add stringsAsFactors=TRUE to all of the results and fix vorder in plot_break_down_distributions