plot_shap {MLwrap}R Documentation

Plotting SHAP Plots

Description

The plot_shap() function implements a comprehensive set of visualizations for SHAP values, including bar plots of mean absolute values, directional plots showing positive or negative contribution nature, box plots illustrating SHAP value distributions by variable, and swarm plots combining individual and distributional information. This multifaceted approach enables deep understanding of how each feature influences model predictions.

Usage

plot_shap(analysis_object, show_table = FALSE)

Arguments

analysis_object

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

show_table

Boolean. Whether to print SHAP summarized results table.

Value

analysis_object

Examples

# Note: For obtaining the SHAP plots 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 plots.

plot_shap(wrap_object)




[Package MLwrap version 0.1.0 Index]