ModelOriented/iBreakDown

bug in plotting distributions on R3.6

Closed this issue · 0 comments

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