CRAN release 0.7.0
Milestone: Working with multiple 'shapviz' objects
Sometimes, you will find it necessary to work with several "shapviz" objects at the same time:
- To visualize SHAP values of a multiclass or multi-output model.
- To compare SHAP plots of different models.
- To compare SHAP plots between subgroups.
To simplify the workflow, {shapviz} introduces the "mshapviz" object ("m" like "multi"). You can create it in different ways:
- Use
shapviz()
on multiclass XGBoost or LightGBM models. - Use
shapviz()
on "kernelshap" objects created from multiclass/multioutput models. - Use
c(Mod_1 = s1, Mod_2 = s2, ...)
on "shapviz" objectss1
,s2
, ... - Or
mshapviz(list(Mod_1 = s1, Mod_2 = s2, ...))
The sv_*()
functions use the {patchwork} package to glue the individual plots together.
See the new vignette for more info and specific examples.
Other new features
sv_dependence()
now allows multiplev
and/orcolor_var
to be plotted (glued via {patchwork}).- {DALEX}: Support for "predict_parts" objects from {DALEX}, thanks to Adrian Stando.
- Aggregated SHAP values: The argument
row_id
ofsv_waterfall()
andsv_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}). - Row bind: "shapviz" objects
x1
,x2
can now be concatenated in rowwise manner usingx1 + x2
orrbind(x1, x2)
, again thanks to Adrian. colnames()
: "shapviz" objectsx
have received adimnames()
function, so you can now, e.g., usecolnames(x)
to see the feature names.- Subsetting: "shapviz"
x
can now be subsetted usingx[cond, features]
.
Maintenance
- We have a new contributor: Adrian Stando - welcome on the SHAP board.
- To be close to my sister package {kernelshap}, I have moved to https://github.com/ModelOriented/shapviz
- Webpage created with "pgkdown"
- New dependency: {patchwork}
Other changes
- Color guides are closer to the plot area. This affects
sv_dependence()
,sv_importance(kind="bee")
, andsv_interaction()
. - The lengthy y axis title "SHAP interaction value" in
sv_dependence()
has been shortened to "SHAP interaction". - As announced, the argument
show_other
ofsv_importance()
has been removed. - Slightly less picky checks on
S_inter
. print.shapviz()
is much more compact, usesummary.shapviz()
for more info.
Bug fixes
sv_waterfall()
: Usingorder_fun()
would not work as expected withmax_display
. This has been fixed.sv_dependence()
: Passingviridis_args = NULL
would hide the color guide title. This has been fixed. But please passviridis_args = list()
instead.