[Paper Review] NeuralSens: Sensitivity Analysis of Neural Networks
This paper introduces the R package NeuralSens, which enables sensitivity analysis of multilayer perceptron (MLP) neural networks using partial derivatives to assess variable importance and input-output relationships. The method computes gradients of outputs with respect to inputs across training data, demonstrating robustness and consistency in sensitivity metrics as model capacity increases.
Neural networks are important tools for data-intensive analysis and are commonly applied to model non-linear relationships between dependent and independent variables. However, neural networks are usually seen as "black boxes" that offer minimal information about how the input variables are used to predict the response in a fitted model. This article describes the \pkg{NeuralSens} package that can be used to perform sensitivity analysis of neural networks using the partial derivatives method. Functions in the package can be used to obtain the sensitivities of the output with respect to the input variables, evaluate variable importance based on sensitivity measures and characterize relationships between input and output variables. Methods to calculate sensitivities are provided for objects from common neural network packages in \proglang{R}, including \pkg{neuralnet}, \pkg{nnet}, \pkg{RSNNS}, \pkg{h2o}, \pkg{neural}, \pkg{forecast} and \pkg{caret}. The article presents an overview of the techniques for obtaining information from neural network models, a theoretical foundation of how are calculated the partial derivatives of the output with respect to the inputs of a multi-layer perceptron model, a description of the package structure and functions, and applied examples to compare \pkg{NeuralSens} functions with analogous functions from other available \proglang{R} packages.
Motivation & Objective
- To develop a method for interpreting black-box neural networks by quantifying the influence of input variables on model outputs.
- To address the challenge of understanding complex, non-linear relationships in neural networks through sensitivity analysis.
- To provide a unified, accessible R package that supports sensitivity analysis across various neural network training frameworks.
- To compare the proposed partial derivatives method with established techniques like Garson’s and Olden’s methods in terms of accuracy and interpretability.
- To validate the robustness of sensitivity metrics under varying model architectures and training conditions.
Proposed method
- The core method computes partial derivatives of the neural network output with respect to each input variable at each training sample using backpropagation.
- Sensitivity measures are aggregated across the dataset, including mean, standard deviation, and sum-of-squares (SensSQ) to assess variable importance.
- The package supports models trained with common R neural network packages (e.g., caret, nnet) and includes a generic 'numeric' method for non-supported models.
- Sensitivity plots are generated to visualize the relationship between input variables and model outputs across input value ranges.
- Robustness is evaluated by training multiple models with different random initializations and assessing variance in sensitivity metrics.
- The method is compared with alternative approaches such as Garson’s, Olden’s, and Lek’s profile methods using benchmark datasets like 'iris'.
Experimental results
Research questions
- RQ1How accurately can partial derivatives from trained MLPs quantify the influence of individual input variables on model outputs?
- RQ2How do sensitivity metrics from the partial derivatives method compare in magnitude and consistency with those from Garson’s and Olden’s methods?
- RQ3What is the impact of model capacity (number of hidden neurons) on the stability and reliability of sensitivity metrics?
- RQ4Can the proposed method effectively visualize non-linear input-output relationships without relying on artificial perturbations?
- RQ5How robust are the sensitivity estimates when trained with different random initializations and varying network architectures?
Key findings
- The partial derivatives method in NeuralSens provides a stable and interpretable measure of variable importance, with sensitivity metrics showing negligible variance when model capacity is sufficient.
- For the iris dataset, Petal.Length and Petal.Width showed the highest sensitivity (SensSQ = 0.3499 for virginica class), aligning with known biological distinctions between species.
- The method demonstrated consistent results across 50 independently trained models with 10 hidden neurons, confirming robustness under weight initialization variation.
- Sensitivity plots generated by NeuralSens effectively revealed non-linear relationships between inputs and outputs, particularly for the virginica class.
- Compared to Garson’s and Olden’s methods, the partial derivatives approach provided more nuanced and continuous insights into input influence, especially in regression and classification tasks.
- The package successfully integrated with existing R neural network workflows and offered comparable or superior interpretability to existing tools like 'lekprofile' and 'partial' functions.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.