Is object of class "kernelshap"?
is.kernelshap(object)
TRUE
if object
is of class "kernelshap", and FALSE
otherwise.
fit <- lm(Sepal.Length ~ ., data = iris)
s <- kernelshap(fit, iris[1:2, -1], bg_X = iris[, -1])
#> Exact Kernel SHAP values
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
is.kernelshap(s)
#> [1] TRUE
is.kernelshap("a")
#> [1] FALSE