plot_contribution_to_sample | R Documentation |
This function plots the contribution (Shapley values) of the top features to a sample's predictions.
plot_contribution_to_sample(
model,
model_data,
name,
sample_names,
n_features = 5,
n_columns = 1,
short_title = FALSE,
fixed_axis = FALSE,
axis_limits = c(-0.05, 1),
nudges_lr = c(0, 0),
values_are_percentages = TRUE,
decreasing = FALSE,
replace_names = FALSE,
sample_info = NULL,
show_error = TRUE,
highlight_significant = FALSE,
plot_new_data = FALSE,
labels_data = NULL,
sec_label = NULL
)
model |
A model generated with make_xgb_models and has appended predictions with add_predictions. |
model_data |
The training dataset used to generate the model. |
name |
The name of the perturbation whose prediction we want to plot. |
sample_names |
The names of the samples we want to generate a plot for. |
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. |
short_title |
If using many columns, set to TRUE to shorten the title of the plot. |
fixed_axis |
If TRUE, the plot will be set to a fixed scale (-0.05 to 1). Default = FALSE. |
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. |
show_error |
If TRUE, a shaded area will be used to visualize prediction interval. Default = TRUE. |
highlight_significant |
If TRUE, a border will be shown to indicate the prediction interval is above 0.5. Default = FALSE. |
plot_new_data |
Set to TRUE if plotting the contribution to a new sample (not used in training). |
plot_contribution_to_sample(my_models, model_dataset, "ko_ctnnb1", "my_sample")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.