plot_shap_scatter: Plot Shapley values vs feature values

View source: R/plots.R

plot_shap_scatterR Documentation

Plot Shapley values vs feature values

Description

This function plots a scatter of the contribution (Shapley values) of a feature against the value of that feature for each sample.

Usage

plot_shap_scatter(
  model,
  name,
  model_data,
  n_features = 4,
  n_columns = 2,
  overlay_predictions = FALSE,
  sample_names = NULL,
  remove_prefix = TRUE,
  sample_colors = NULL,
  sample_info = NULL
)

Arguments

model

A model generated with make_xgb_models and has appended predictions with add_predictions.

name

The name of the perturbation whose prediction we want to plot.

model_data

The training dataset used to generate the model.

n_features

The number of top contributors to show their individual contribution. All other predictors will have their contribution combined.

n_columns

Number of columns to plot in a grid when plotting more than one sample.

sample_names

The names of the samples we want to highlight.

sample_colors

If highlighting samples (with sample_names), this is a vector of colors to use.

Examples

plot_shap_scatter(my_models, model_dataset, "ko_ctnnb1", "my_sample", "red")

Mushriq/mixmap documentation built on Jan. 28, 2024, 7:22 p.m.