ModelOriented/iBreakDown

Hidden last contribution label in the break_down plot

hbaniecki opened this issue · 5 comments

@hbaniecki Thank you for pointing us the docs for iBreakDown, etc.!
I don't know if this is helpful but I got this minor issue a while ago for binary classification models.
The prediction for the positive cases works fine, but for negative cases the prediction becomes unreadable.
image

adding vcolors to the generic plot function worked for me:

bd_glm <- variable_attribution(explainer_glm, 
                               new_observation = x_test[1,],
                               type="break_down")

bd_glm2 <- variable_attribution(explainer_glm,
                                new_observation = x_test[30,],
                                type="break_down")
bd_colors <- c("#f05a71","#4378bf", "#8bdcbe", "#ffa58c")

p1 <- plot(bd_glm2, vcolors = bd_colors)
p2 <- plot(bd_glm, vcolors = bd_colors)

image

Thanks for your reply!

Originally posted by @marcjermaine-pontiveros in ModelOriented/DALEX#176 (comment)

This issue was reported numerous times. A possible solution (implemented in modelStudio) is to place the prediction number on the left side of the prediction bar (so it is always visible).

Edit: Unable to resolve, because the baseline parameter makes this situation hard to detect, and nudge_y is not an aes parameter.

@hbaniecki would you check if d574460 solves this issue? maybe I've missed something

My intention was to place this text on the left side of the bar. The candidate fix is still better than no fix. Can we do the same for the intercept bar? See

library("DALEX")
library("iBreakDown")
set.seed(1313)
model_titanic_glm <- glm(survived ~ gender + age + fare,
                         data = titanic_imputed, family = "binomial")
explain_titanic_glm <- explain(model_titanic_glm,
                               data = titanic_imputed,
                               y = titanic_imputed$survived,
                               label = "glm")

bd_glm <- local_attributions(explain_titanic_glm, titanic_imputed[1, ])
bd_glm
plot(bd_glm, max_features = 3, baseline=0.5)

thanks,
in a979cb4 the positioning works also for the intercept.

now it's on the right side, in next version we can add an option for this

Thanks