Rowbinds multiple "shapviz" objects based on the +
operator.
A new object of class "shapviz" or "mshapviz".
S <- matrix(c(1, -1, -1, 1), ncol = 2, dimnames = list(NULL, c("x", "y")))
X <- data.frame(x = c("a", "b"), y = c(100, 10))
s1 <- shapviz(S, X, baseline = 4)[1]
s2 <- shapviz(S, X, baseline = 4)[2]
s <- rbind(s1, s2)
s
#> 'shapviz' object representing 2 x 2 SHAP matrix. Top lines:
#>
#> x y
#> [1,] 1 -1
#> [2,] -1 1
# mshapviz
S <- matrix(c(1, -1, -1, 1), ncol = 2, dimnames = list(NULL, c("x", "y")))
X <- data.frame(x = c("a", "b"), y = c(100, 10))
s1 <- shapviz(S, X, baseline = 4)[1L]
s2 <- shapviz(S, X, baseline = 4)[2L]
s <- mshapviz(c(shp1 = s1, shp2 = s2))
rbind(s, s)
#> 'mshapviz' object representing 2 'shapviz' objects:
#> 'shp1': 2 x 2 SHAP matrix
#> 'shp2': 2 x 2 SHAP matrix