| plot_qshap | R Documentation |
Convenience wrapper that works for both a 'qshap_rsq' object and a plain numeric vector of contributions. Use this if you have a numeric vector and still want to pass arguments like 'color_map_name'.
plot_qshap(
x,
type = c("rsq", "elbow", "cumu", "gcorr", "hist", "density", "loss", "heatmap",
"loss_heatmap"),
...
)
x |
A 'qshap_rsq' object (recommended) or a numeric vector. |
type |
Plot type; see 'plot.qshap_rsq'. Use '"loss"' to launch the interactive explorer or '"heatmap"' for the static raster heatmap. |
... |
Additional arguments passed to the underlying visualization function (e.g., 'label', 'rotation', 'color_map_name', 'max_feature'). |
The ggplot2 plot object (invisibly)
library(xgboost)
set.seed(42)
n <- 100
p <- 100
X <- matrix(rnorm(n * p), nrow = n, ncol = p)
y <- X[, 1] - X[, 2] + rnorm(n, sd = 0.2)
model <- xgboost(X, y, nrounds = 15L, max_depth = 2L, verbosity = 0L, nthreads = 1L)
explainer <- gazer(model)
phi_rsq <- rsq(explainer, X, y)
plot(phi_rsq)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.