ceterisParibus icon indicating copy to clipboard operation
ceterisParibus copied to clipboard

Feature request: option to display density plots with Ceteris Paribus profiles/breakdown plots

Open nspyrison opened this issue 1 year ago • 0 comments

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.

image

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)))

nspyrison avatar Oct 23 '23 15:10 nspyrison