Skip to contents

Plot exact XGBoost SHAP values against feature values across all training samples for one perturbation. Optionally highlight selected training samples or user samples predicted with add_powerup_predictions().

Usage

plot_shap_scatter(
  models,
  prepared,
  perturbation,
  n_features = 6,
  features = NULL,
  samples = NULL,
  source = "training",
  n_columns = 3,
  sample_colors = NULL
)

Arguments

models

A named list of models returned by fit_powerup_models().

prepared

The prepared POWERUP object used for model training and prediction.

perturbation

A single perturbation name to plot.

n_features

Number of top contributing features to plot when features is NULL.

features

Optional character vector of specific model features to plot.

samples

Optional character vector of samples to highlight.

source

Either "training" (default) or "user". User samples require models that have been passed through add_powerup_predictions().

n_columns

Number of columns in the resulting plot grid.

sample_colors

Optional colors for highlighted samples.

Value

A combined ggplot object containing SHAP dependence panels for the selected features.

Examples

if (FALSE) { # \dontrun{
plot_shap_scatter(
  models,
  prepared,
  perturbation = "CTNNB1"
)

plot_shap_scatter(
  models,
  prepared,
  perturbation = "CTNNB1",
  samples = "ACH-000957",
  source = "user"
)
} # }