| plot.gg_shap | R Documentation |
gg_shap objectRoutes to one of three SHAP views. type = "beeswarm" (default) draws
the signature SHAP summary; "importance" draws a mean-absolute-SHAP
bar chart; "dependence" draws SHAP value against a single feature's
value.
## S3 method for class 'gg_shap'
plot(x, type = c("beeswarm", "importance", "dependence"), xvar = NULL, ...)
x |
A |
type |
One of |
xvar |
For |
... |
Passed to the underlying builder. |
A ggplot object.
gg_shap shap_importance
if (requireNamespace("kernelshap", quietly = TRUE)) {
rf <- randomForestSRC::rfsrc(Ozone ~ ., data = na.omit(airquality),
ntree = 50)
gg_dta <- gg_shap(rf, bg_n = 20)
plot(gg_dta, type = "importance")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.