The long form a beeswarm reads: a point per case per feature, positioned by its contribution and colored by the value the feature took.
Value
data.table with columns case, feature, value, numeric_value
and contribution. numeric_value is NA for a feature that is not numeric,
which is what a color scale needs to skip it.
Details
Shaped here, for the reason shap_case() gives.
Examples
x <- data.frame(age = rnorm(100), bmi = rnorm(100))
x[["y"]] <- x[["age"]] * 2 + rnorm(100, sd = 0.3)
mod <- train(x, hyperparameters = setup_GLM(), verbosity = 0L)#> Error in UseMethod("train"): no applicable method for 'train' applied to an object of class "data.frame"contributions <- explain(
mod,
x[, c("age", "bmi")],
background = x[, c("age", "bmi")],
verbosity = 0L
)#> Error: object 'mod' not found#> Error: object 'contributions' not found