plot_integrated_gradients: Plotting Integrated Gradients Plots

View source: R/plotting_utils.R

plot_integrated_gradientsR Documentation

Plotting Integrated Gradients Plots

Description

The plot_integrated_gradients() function replicates the SHAP visualization structure for integrated gradient values, providing the same four graphical modalities adapted to this specific interpretability methodology for neural networks. This function is particularly valuable for understanding feature importance in deep learning architectures where gradients provide direct information about model sensitivity.

Usage

plot_integrated_gradients(analysis_object, show_table = FALSE)

Arguments

analysis_object

Fitted analysis_object with 'sensitivity_analysis(methods = "Integrated Gradients")'.

show_table

Boolean. Whether to print Integrated Gradients summarized results table.

Value

analysis_object

Examples

# Note: For obtaining the Integrated Gradients plot the user needs to
# complete till sensitivity_analysis( ) function of the MLwrap pipeline
# using the Integrated Gradients method.

if (requireNamespace("torch", quietly = TRUE)) {

  

  wrap_object <- preprocessing(df = sim_data,
                             formula = psych_well ~ depression + emot_intel + resilience,
                             task = "regression")
  wrap_object <- build_model(wrap_object, "Neural Network")
  wrap_object <- fine_tuning(wrap_object, "Bayesian Optimization")
  wrap_object <- sensitivity_analysis(wrap_object, methods = "Integrated Gradients")

  # And then, you can obtain the Integrated Gradients plot.

  plot_integrated_gradients(wrap_object)

  

}


MLwrap documentation built on Aug. 8, 2025, 6:43 p.m.