Closed mayer79 closed 1 year ago
Implemented in https://github.com/ModelOriented/shapviz/pull/74
Example from new vignette:
library(ggplot2)
library(shapviz)
library(patchwork)
library(ranger)
library(kernelshap)
fit <- ranger(Species ~ ., data = iris, num.trees = 100L, probability = TRUE)
x <- kernelshap(fit, X = iris, bg_X = iris)
shp <- setNames(shapviz(x), levels(iris$Species))
sv_dependence(shp, v = "Sepal.Width") +
plot_layout(ncol = 1L) &
ylim(-0.025, 0.03)
Introduce class "mshapviz" that would combine multiple "shapviz" objects representing SHAP values from
Multiple "shapviz" objects could be combined to a "mshapviz" object by
c(...)
ormshapviz(...)
. Existing methods like[
,+
,rbind
,colnames
,dim
would need to be written to cover "mshapviz" objects as well.As a start, the
sv_xyz()
plot functions would usepatchwork::wrap_plots(list)
. The resulting combined plot can be modified using&
, e.g.,& ylim(...)
. This gives quite some flexibility.