View source: R/plotting_utils.R
plot_shap | R Documentation |
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.
plot_shap(analysis_object, show_table = FALSE)
analysis_object |
Fitted analysis_object with 'sensitivity_analysis(methods = "SHAP")'. |
show_table |
Boolean. Whether to print SHAP summarized results table. |
analysis_object
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.