Changelog
Source:NEWS.md
fastshap 0.1.1
Changed
- This NEWS file now follows the Keep a Changelog format.
Fixed
- Removed an unnecessary
.Rd
file to satisfy CRAN policies. - Fixed a couple of outdated URLs.
- Added earth to the list of suggested packages since it’s referenced a couple of times in the package documentation.
fastshap 0.1.0
CRAN release: 2023-06-06
Breaking changes
The
explain()
function now returns a matrix, as opposed to a tibble, which makes more sense since Shapley values values are ALWAYS numeric; data frames (and tibbles’s) are really only necessary when the data are heterogeneous. In essence, the output fromexplain()
will act like an R matrix but with class structurec("explain", "matrix", "array")
; you could always convert the results to a tibble usingtibble::as_tibble(result)
.Two new data sets,
titanic
andtitanic_mice
, were added to the package; see the corresponding help pages for details.The plotting functions have all been deprecated in favor of the (far superior) shapviz package by @Mayer79 (
grid.arrange()
is also no longer imported from gridExtra). Consequently, the output fromexplain()
no longer needs to have its own"explain"
class (only an ordinaryc("matrix", "array")
object is returned).-
The
explain()
function gained three new arguments:baseline
, which defaults toNULL
, containing the baseline to use when adjusting Shapley values to meet the efficiency property. IfNULL
andadjust = TRUE
, it will default to the average training prediction (i.e., the average prediction overX
.)shap_only
, which defaults toTRUE
, determines whether to return a matrix of Shapley values (TRUE
) containing the baseline as aanattribute or a list containing the Shapley values, corresponding feature values, and baseline (FALSE
); setting toFALSE
is a convenience when using the shapviz package.parallel
, which defaults toFALSE
for determining whether or not to compute Shapley values in parallel (across features) using any suitable parallel backend supported by foreach.
Miscellaneous
The
X
andnewdata
arguments ofexplain()
should now work with tibble (#20).Minor change to
explain.lgb.Booster()
to support breaking changes in lightgbm v4.0.0. (Thanks to @jameslamb and @Mayer79.)The dependency on matrixStats has been removed in favor of using R’s internal
apply()
andvar()
functions.The dependency on plyr, which has been retired, has been removed in favor of using foreach directly.
Removed CXX_STD=CXX11 flag, so increased R dependency to R >= 3.6.
fastshap 0.0.7
CRAN release: 2021-12-06
Miscellaneous
- Move lightgbm tests to
slowtests/
directory (for now).
fastshap 0.0.6
CRAN release: 2021-12-03
Bug fixes
The
force_plot()
function should now be compatible with shap (>=0.36.0); thanks to @hfshr and @jbwoillard for reporting (#12).Fixed minor name repair issue caused by tibble.
fastshap 0.0.4
CRAN release: 2020-01-26
Enhancements
- Function
explain()
should now be MUCH faster at explaining a single observation, especially whennsim
is relatively large (e.g.,nsim >= 1000
).
New features
The default method of
explain()
gained a new logical argument calledadjust
. Whenadjust = TRUE
(andnsim > 1
), the algorithm will adjust the sum of the estimated Shapley values to satisfy the efficiency property; that is, to equal the difference between the model’s prediction for that sample and the average prediction over all the training data. This option is experimental and we follow the same approach as in shap (#6).New (experimental) function for constructing force plots (#7) to help visualize prediction explanations. The function is also a generic which means additional methods can be added.
Function
explain()
became a generic and gained a new logical argument,exact
, for computing exact Shapley contributions for linear models (Linear SHAP, which assumes independent features) and boosted decision trees (Tree SHAP). Currently, only"lm"
,"glm"
, and"xgb.Booster"
objects are supported (#2)(#3).
fastshap 0.0.2
CRAN release: 2019-11-22
New features
You can now specify
type = "contribution"
in the call toautoplot.fastshap()
to plot the explanation for a single instance (controlled by therow_num
argument).-
autoplot.fastshap()
gained some useful new arguments:color_by
for specifying an additional feature to color by for dependence plots (i.e., whenevertype = "dependence"
);smooth
,smooth_color
,smooth_linetype
,smooth_size
, andsmooth_alpha
for adding/controlling a smoother in dependence plots (i.e., whenevertype = "dependence"
)....
which can be used to pass on additional parameters togeom_col()
(whentype = "importance"
) orgeom_point()
(whentype = "dependence"
).
Breaking changes
Function
fastshap()
was renamed toexplain()
.Functions
explain()
andexplain_column()
(not currently exported) now throw an error whenever the inputsX
andnewdata
do not inherit from the same class.
Bug fixes
Fixed a bug in the C++ source that gave more weight to extreme permutations.
Fixed a bug in the C++ source that caused doubles to be incorrectly converted to integers.
Fixed a bug in
autoplot.fastshap()
whentype = "importance"
; in particular, the function incorrectly usedsum(|Shapley value|)
instead ofmean(|Shapley value|)
.