Skip to content

Commit 3e5c75d

Browse files
committed
Adapt README
1 parent 88cb3c4 commit 3e5c75d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The package contains two workhorses to calculate SHAP values for *any* model:
1919
- `kernelshap()`: Kernel SHAP algorithm of [2] and [3]. By default, exact Kernel SHAP is used for up to $p=8$ features, and an almost exact hybrid algorithm otherwise.
2020

2121
Furthermore, the function `additive_shap()` produces SHAP values for additive models fitted via `lm()`, `glm()`, `mgcv::gam()`, `mgcv::bam()`, `gam::gam()`,
22-
`survival::coxph()`, or `survival::survreg()`.
22+
`survival::coxph()`, or `survival::survreg()`. It is exponentially faster than `permshap()` and `kernelshap()` and provides identical results.
2323

2424
### Kernel SHAP or permutation SHAP?
2525

@@ -41,6 +41,7 @@ If the training data is small, use the full training data. In cases with a natur
4141
- Factor-valued predictions are automatically turned into one-hot-encoded columns.
4242
- Case weights are supported via the argument `bg_w`.
4343
- By changing the defaults in `kernelshap()`, the iterative pure sampling approach in [3] can be enforced.
44+
- The `additive_shap()` explainer is easier to use: Only the model and `X` are required.
4445

4546
## Installation
4647

@@ -218,6 +219,18 @@ sv_dependence(ps, xvars)
218219

219220
![](man/figures/README-nn-dep.svg)
220221

222+
### Additive SHAP
223+
224+
The additive explainer extracts the additive contribution of each feature from a model of suitable class.
225+
226+
```r
227+
fit <- lm(log(price) ~ log(carat) + color + clarity + cut, data = diamonds)
228+
shap_values <- additive_shap(fit, diamonds) |>
229+
shapviz()
230+
sv_importance(shap_values)
231+
sv_dependence(shap_values, v = "carat", color_var = NULL)
232+
```
233+
221234
### Multi-output models
222235

223236
{kernelshap} supports multivariate predictions like:

0 commit comments

Comments
 (0)