Learn R Programming

MLwrap (version 0.1.0)

table_shap_results: SHAP Summarized Results Table

Description

The table_shap_results() function processes previously calculated SHAP (SHapley Additive exPlanations) values and generates summarized metrics including mean absolute value, standard deviation of mean absolute value, and a directional sensitivity value calculated as the covariance between feature values and SHAP values divided by the variance of feature values. This directional metric provides information about the nature of the relationship between each variable and model predictions. To summarize the SHAP values calculated, three different metrics are computed:

  • Mean Absolute Value

  • Standard Deviation of Mean Absolute Value

  • Directional Sensitivity Value (Cov(Feature values, SHAP values) / Var(Feature values))

Usage

table_shap_results(analysis_object, show_table = FALSE)

Value

Tibble or list of tibbles (multiclass classification) with SHAP summarized results.

Arguments

analysis_object

Fitted analysis_object with 'sensitivity_analysis(methods = "SHAP")'.

show_table

Boolean. Whether to show the table.

Examples

Run this code
# Note: For obtaining the table with SHAP method results the user needs
# to complete till sensitivity_analysis() function of the
# MLwrap pipeline using the SHAP method.

# \donttest{

wrap_object <- preprocessing(df = sim_data,
                             formula = psych_well ~ depression + emot_intel + resilience,
                             task = "regression")
wrap_object <- build_model(wrap_object, "Random Forest")
wrap_object <- fine_tuning(wrap_object, "Bayesian Optimization")
wrap_object <- sensitivity_analysis(wrap_object, methods = "SHAP")

# And then, you can obtain the SHAP results table.

table_shap <- table_shap_results(wrap_object)

# }

Run the code above in your browser using DataLab