Closed agilebean closed 4 years ago
Thansk, very important point, can you give a reproducible example?
We are using the iBreakDown::nice_format
to round values (by default with signif(,4)).
and I cannot reproduce this problem because numerics are rounded in examples that I've tried/
By default names are rounded with signif(,4)
,
but now you can overwrite labels with the vnames
argument
see https://github.com/ModelOriented/iBreakDown/commit/b2e96a0ed6ce271e49f0dec8d30a8365e6e30710
It would still be great if the labels could be created automatically without using vnames. I prepared a reproducible example with this model
Please use it like this:
models.list.short <- readRDS("models.list.short.rds")
model.rf <- models.list.short$rf
local.obs <- models.list.short$testing.set %>%
# filter(reviews.rating != 5 & reviews.rating != 4) %>%
filter(reviews.rating == TARGET.VALUE) %>%
select(-reviews.rating) %>%
sample_n(5)
DALEX.explainer <- DALEX::explain(
model = model.rf,
data = features,
y = target == TARGET.VALUE,
label = paste(model_object$method, " model"),
colorize = TRUE
)
DALEX.attribution <- DALEX.explainer %>%
iBreakDown::local_attributions(
local.obs,
keep_distributions = TRUE
)
DALEX.attribution.plot <- DALEX.attribution %>%
plot(
digits = 3,
shift_contributions = 0.03
) %>% print
I just used it and still got the unrounded figures
@agilebean for some strange reason the problem comes from local.obs being a tibble. this will work properly with local.obs converted to data.frame
DALEX.attribution <- DALEX.explainer %>%
iBreakDown::local_attributions(
as.data.frame(local.obs),
keep_distributions = TRUE
)
That is truly unexpected. Thanks for finding that out!!
It's because for tibbles the local.obs[1,1]
is not numeric (it's still tilbble)
so iBreakDown does not know how to prettify and treats these values as characters
For regressions, the table returned by
local_attributions()
contains values that are not rounded (left column):This would not be an issue, however, the plot becomes too wide which narrows the main plot:
Is there any way to round the decimal values in the y-axis?