plot_contribution_to_training_samples: Plot feature contributions to sample predictions from the...

View source: R/plots.R

plot_contribution_to_training_samplesR Documentation

Plot feature contributions to sample predictions from the training set.

Description

This function plots the contribution (Shapley values) of the top features to a sample's predictions.

Usage

plot_contribution_to_training_samples(
  models,
  models_to_use,
  model_data,
  samples_to_use = NULL,
  lineage_to_use = NULL,
  n_features = 5,
  n_columns = 1,
  fixed_axis = TRUE,
  axis_limits = c(-0.05, 1),
  nudges_lr = c(0, 0),
  show_error = TRUE,
  highlight_significant = FALSE,
  replace_names = FALSE,
  sample_info = NULL,
  labels_data = NULL,
  sec_label = NULL,
  values_are_percentages = TRUE,
  decreasing = FALSE
)

Arguments

models

A list of models generated with make_xgb_models and has appended predictions with add_predictions.

models_to_use

A vector of model names 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.

fixed_axis

If TRUE, the plot will be set to a fixed scale (-0.05 to 1). Default = FALSE.

show_error

If TRUE, a shaded area will be used to visualize prediction interval. Default = TRUE.

replace_names

If TRUE, the sample name will be replaced using get_cell_line_name. Must supply sample_info.

sample_info

If replace_names is TRUE, this must be supplied.

short_title

If using many columns, set to TRUE to shorten the title of the plot.

Examples

plot_contribution_to_training_sample(my_models, c("ko_ctnnb1","ko_myod1"), model_dataset, lineage_to_use = "soft_tissue")

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