plot_contribution_to_new_samples | R Documentation |
This function plots the contribution (Shapley values) of the top features to a sample's predictions, using new samples.
plot_contribution_to_new_samples(
models,
models_to_use,
model_data,
new_samples_to_use = NULL,
n_features = 5,
n_columns = 4,
fixed_axis = TRUE,
axis_limits = c(-0.05, 1),
nudges_lr = c(0, 0),
show_error = TRUE,
values_are_percentages = TRUE,
decreasing = FALSE,
highlight_significant = TRUE,
short_title = TRUE,
sample_info = NULL,
labels_data = NULL,
sec_label = NULL
)
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. |
short_title |
If using many columns, set to TRUE to shorten the title of the plot. |
sample_info |
If replace_names is TRUE, this must be supplied. |
replace_names |
If TRUE, the sample name will be replaced using get_cell_line_name. Must supply sample_info. |
plot_contribution_to_sample_demo(my_models, c("ko_ctnnb1","ko_myod1"), model_dataset, "soft_tissue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.