Learn R Programming

mrIML (version 2.2.0)

mrShapely: Generate SHAP (SHapley Additive exPlanations) Plots for Multiple Models and Responses

Description

This function generates SHAP (SHapley Additive exPlanations) plots for multiple models and responses.

Usage

mrShapely(
  mrIML_obj,
  taxa = NULL,
  kind = "beeswarm",
  max_display = 15L,
  plot_feature_effects = TRUE,
  plot_dependencies = TRUE,
  plot_2D_dependencies = TRUE
)

Value

A list object where the first element returns the SHAP results, and the following elements contain the feature-effect, 1D-dependencies, and 2D-dependencies if they were set to TRUE in the input.

Arguments

mrIML_obj

A list object output by mrIMLpredicts().

taxa

An optional character vector specifying which responses to include.

kind

A character string passed to shapviz::sv_importance() specifying the type of plot parameter (e.g., "beeswarm" for feature effect plot, "bar" for variable importance plot, or "both").

max_display

An integer passed to shapviz::sv_importance() specifying the maximum number of features to display.

plot_feature_effects

A logical indicating whether to generate feature effect plots (default is TRUE).

plot_dependencies

A logical indicating whether to generate dependency plots (default is TRUE).

plot_2D_dependencies

A logical indicating whether to generate interaction plots (default is TRUE).

Examples

Run this code
if (FALSE) { # identical(Sys.getenv("NOT_CRAN"), "true")
mrIML_model <- mrIML::mrIML_bird_parasites_RF

shapely_plots_list <- mrShapely(mrIML_model, plot_2D_dependencies = FALSE)
}

Run the code above in your browser using DataLab