Prints the first n
rows of the matrix (or matrices) of SHAP values.
# S3 method for permshap
print(x, n = 2L, ...)
An object of class "permshap".
Maximum number of rows of SHAP values to print.
Further arguments passed from other methods.
Invisibly, the input is returned.
fit <- lm(Sepal.Length ~ ., data = iris)
s <- permshap(fit, iris[1:3, -1], bg_X = iris[-1])
#> Exact permutation SHAP values
#>
|
| | 0%
|
|======================= | 33%
|
|=============================================== | 67%
|
|======================================================================| 100%
s
#> SHAP values of first 2 observations:
#> Sepal.Width Petal.Length Petal.Width Species
#> [1,] 0.21951350 -1.955357 0.3149451 0.5823533
#> [2,] -0.02843097 -1.955357 0.3149451 0.5823533