ceterisParibus
ceterisParibus copied to clipboard
Feature request: option to display density plots with Ceteris Paribus profiles/breakdown plots
Use case: If there is massive change in the prediction, how dense/confident are the data in this range of the CP profile? If it's sparce I may not put much weight into that change.
My quick patchwork solution follows. Maybe overlaid is better?
a <- DALEX::model_profile(explainer = explainer_rf,
variables = as.character(top_vars$var[i])) %>%
plot()
b <- ggplot(rf_df) +
geom_density(aes(x=.data[[top_vars$var[i]]]),
data=rf_df, group=1, fill="midnightblue") +
DALEX::theme_default_dalex()
library("patchwork")
print(a / b + patchwork::plot_layout(heights = c(3, 1)))