Bug fix
With input from Mario Wuethrich and Ian Covert and his repo,
we have fixed a bug in how kernelshap() calculates Kernel weights.
- The differences caused by this are typically very small.
- Models with interactions of order up to two have been unaffected.
- Exact Kernel SHAP now provides identical results to exact permutation SHAP.
Fixed in #168, which also has received
unit tests against Python's "shap".
API
- The argument
feature_namescan now also be used with matrix input (#166). kernelshap()andpermshap()have received aseed = NULLargument (#170).- Parallel mode: If missing packages or globals have to be specified, this now has to be done through
parallel_args = list(packages = ..., globals = ...)
instead ofparallel_args = list(.packages = ..., .globals = ...), see section on parallelism below.
The list is passed to[foreach::foreach(.options.future = ...)].
Speed and memory improvements
permshap()andkernelshap()require about 10% less memory (#166).permshap()andkernelshap()are faster for data.frame input,
and slightly slower for matrix input (#166).- Additionally,
permshap(, exact = TRUE)is faster by pre-calculating more
elements used across rows (#165).
Internal changes
- Matrices holding on-off vectors are now consistently of type logical (#167).
kernelshap()solver: Replacing the Moore-Penrose pseudo-inverse by two direct solves, a trick of Ian Covert,
and ported to R in (#171).
Changes in parallelism
We have switched from %dopar% to doFuture (#170) with the following impact:
- No need for calling
registerDoFuture()anymore. - Random seeding is properly handled, and respects
seed, thanks #163 for reporting. - If missing packages or globals have to be specified, this now has to be done through
parallel_args = list(packages = ..., globals = ...)
instead ofparallel_args = list(.packages = ..., .globals = ...). The list is passed to[foreach::foreach(.options.future = ...)].
Dependencies
- {MASS}: Dropped from imports
- {doFuture}: suggests -> imports