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
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,40 @@ Kernel SHAP in the Python implementation "shap" uses a quite similar hybrid stra
53
53
- Predictions of `mgcv::gam()` would cause an error in `check_pred()` (they are 1D-arrays).
54
54
- Fixed small mistakes in the examples of the README (mlr3 and mgcv).
55
55
56
+
# kernelshap 0.2.0
57
+
58
+
## Breaking change
59
+
60
+
The interface of `kernelshap()` has been revised. Instead of specifying a prediction function, it suffices now to pass the fitted model object. The default `pred_fun` is now `stats::predict`, which works in most cases. Some other cases are catched via model class ("ranger" and mlr3 "Learner"). The `pred_fun` can be overwritten by a function of the form `function(object, X, ...)`. Additional arguments to the prediction function are passed via `...` of `kernelshap()`.
- Logistic regression (probabilities): `kernelshap(fit, X, bg_X, type = "response")`
66
+
- Linear regression with logarithmic response, but evaluated on original scale: Here, the default predict function needs to be overwritten: `kernelshap(fit, X, bg_X, pred_fun = function(m, X) exp(predict(m, X)))`
67
+
68
+
## Major improvements
69
+
70
+
-`kernelshap()` has received a more intuitive interface, see breaking change above.
71
+
- The package now supports multidimensional predictions. Hurray!
72
+
- Thanks to David Watson, parallel computing is now supported. The user needs to set up the parallel backend before calling `kernelshap()`, e.g., using the "doFuture" package, and then set `parallel = TRUE`. Especially on Windows, sometimes not all global variables or packages are loaded in the parallel instances. These can be specified by `parallel_args`, a list of arguments passed to `foreach()`.
73
+
- Even without parallel computing, `kernelshap()` has become much faster.
74
+
- For $2 \le p \le 5$ features, the algorithm now returns exact Kernel SHAP values with respect to the given background data. (For $p = 1$, exact *Shapley values* are returned.)
75
+
- Direct handling of "tidymodels" models.
76
+
77
+
## User visible changes
78
+
79
+
- Besides `matrix`, `data.frame`s, and `tibble`s, the package now also accepts `data.table`s (if the prediction function can deal with them).
80
+
-`kernelshap()` is less picky regarding the output structure of `pred_fun()`.
81
+
-`kernelshap()` is less picky about the column structure of the background data `bg_X`. It should simply contain the columns of `X` (but can have more or in different order). The old behaviour was to launch an error if `colnames(X) != colnames(bg_X)`.
82
+
- The default `m = "auto"` has been changed from `trunc(20 * sqrt(p))` to `max(trunc(20 * sqrt(p)), 5 * p`. This will have an effect for cases where the number of features $p > 16$. The change will imply more robust results for large p.
83
+
- There were too many "ks_*()" functions to extract elements of a "kernelshap" object. They are now all deprecated and replaced by `ks_extract(, what = "S")`.
84
+
- Added "MASS", "doRNG", and "foreach" to dependencies.
85
+
86
+
## Bug fixes
87
+
88
+
- Depending on $m$ and $p$, the matrix inversion required in the constrained least-squares solution could fail. It is now replaced by `MASS::ginv()`, the Moore-Penrose pseudoinverse using `svd()`.
0 commit comments