table_shap_results {MLwrap} | R Documentation |
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)
Arguments
analysis_object |
Fitted analysis_object with 'sensitivity_analysis(methods = "SHAP")'. |
show_table |
Boolean. Whether to show the table. |
Value
Tibble or list of tibbles (multiclass classification) with SHAP summarized results.
Examples
# 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.
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)