You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: NEWS.md
+29-6
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,32 @@
1
1
# shapviz 0.7.0
2
2
3
-
## New features
3
+
## Milestone: Working with multiple 'shapviz' objects
4
4
5
-
- Multiple models: Use `c(xgb = s1, rf = s2, ...)` or `mshapviz(list(xgb = s1, rf = s2, ...))` to combine multiple "shapviz" objects to a "mshapviz" object. Their plots are glued together by the {patchwork} package and can modified, e.g., using `&` and other {patchwork} functionalities.
6
-
- Multiclass: Another way to create a "mshapviz" object is to call `shapviz()` to multiclass XGBoost/LightGBM/kernelshap objects.
5
+
Sometimes, you will find it necessary to work with several "shapviz" objects at the same time:
6
+
7
+
- To visualize SHAP values of a multiclass or multi-output model.
8
+
- To compare SHAP plots of different models.
9
+
- To compare SHAP plots between subgroups.
10
+
11
+
To simplify the workflow, {shapviz} introduces the "mshapviz" object ("m" like "multi"). You can create it in different ways:
12
+
13
+
- Use `shapviz()` on multiclass XGBoost or LightGBM models.
14
+
- Use `shapviz()` on "kernelshap" objects created from multiclass/multioutput models.
15
+
- Use `c(Mod_1 = s1, Mod_2 = s2, ...)` on "shapviz" objects `s1`, `s2`, ...
16
+
- Or `mshapviz(list(Mod_1 = s1, Mod_2 = s2, ...))`
17
+
18
+
The `sv_*()` functions use the {patchwork} package to glue the individual plots together.
19
+
20
+
See the new vignette for more info and specific examples.
21
+
22
+
## Other new features
23
+
24
+
-`sv_dependence()` now allows multiple `v` and/or `color_var` to be plotted (glued via {patchwork}).
7
25
- {DALEX}: Support for "predict_parts" objects from {DALEX}, thanks to Adrian Stando.
8
26
- Aggregated SHAP values: The argument `row_id` of `sv_waterfall()` and `sv_force()` now also allows a vector of integers or a logical vector. If more than one row is selected, SHAP values and predictions are averaged before plotting (*aggregated SHAP values* in {DALEX}).
9
27
- Row bind: "shapviz" objects `x1`, `x2` can now be concatenated in rowwise manner using `x1 + x2` or `rbind(x1, x2)`, again thanks to Adrian.
10
28
-`colnames()`: "shapviz" objects `x` have received a `dimnames()` function, so you can now, e.g., use `colnames(x)` to see the feature names.
11
29
- Subsetting: "shapviz" `x` can now be subsetted using `x[cond, features]`.
12
-
- New vignette on working with multiple "shapviz" objects.
13
30
14
31
## Maintenance
15
32
@@ -18,13 +35,19 @@
18
35
- Webpage created with "pgkdown"
19
36
- New dependency: {patchwork}
20
37
21
-
## Other changes and bug fixes
38
+
## Other changes
22
39
40
+
- Color guides are closer to the plot area. This affects `sv_dependence()`, `sv_importance(kind="bee")`, and `sv_interaction()`.
41
+
- The lengthy y axis title "SHAP interaction value" in `sv_dependence()` has been shortened to "SHAP interaction".
23
42
- As announced, the argument `show_other` of `sv_importance()` has been removed.
24
43
- Slightly less picky checks on `S_inter`.
25
-
-`sv_waterfall()`: Using `order_fun()` would not work as expected with `max_display`.
26
44
-`print.shapviz()` is much more compact, use `summary.shapviz()` for more info.
27
45
46
+
## Bug fixes
47
+
48
+
-`sv_waterfall()`: Using `order_fun()` would not work as expected with `max_display`. This has been fixed.
49
+
-`sv_dependence()`: Passing `viridis_args = NULL` would hide the color guide title. This has been fixed. But please pass `viridis_args = list()` instead.
SHAP (SHapley Additive exPlanations, [1]) is an ingenious way to study black box models. SHAP values decompose - as fair as possible - predictions into additive feature contributions. Crunching SHAP values requires clever algorithms by clever people. Analyzing them, however, is super easy with the right visualizations. {shapviz} offers the latter:
17
17
@@ -39,12 +39,12 @@ To further simplify the use of {shapviz}, we added direct connectors to:
@@ -93,6 +84,9 @@ One line of code creates a "shapviz" object. It contains SHAP values and feature
93
84
In this example, we construct the "shapviz" object directly from the fitted XGBoost model. Thus we also need to pass a corresponding prediction dataset `X_pred` used for calculating SHAP values by XGBoost.
A scatterplot of SHAP values of a feature like `color` against its observed values gives a great impression on the feature effect on the response. Vertical scatter gives additional info on interaction effects (using a heuristic to select the feature on the color axis).
@@ -166,24 +152,39 @@ sv_dependence(shp, v = "color")
166
152
167
153

168
154
155
+
Or multiple features together, using {patchwork}:
156
+
157
+
```r
158
+
library(patchwork) # We need the & operator
159
+
160
+
sv_dependence(shp, v=x) &
161
+
theme_gray(base_size=9) &
162
+
ylim(-5000, 15000)
163
+
```
164
+
165
+

166
+
169
167
### Interactions
170
168
171
-
If SHAP interaction values have been computed (via {xgboost} or {treeshap}), the dependence plot can focus on main effects or SHAP interaction effects (multiplied by two due to symmetry):
169
+
If SHAP interaction values have been computed (via {xgboost} or {treeshap}), the dependence plot can focus on main effects or SHAP interaction effects (multiplied by two due to symmetry).
0 commit comments