Interpreting Deep Neural Networks with the Package innsight
Niklas Koenen, Marvin N. Wright
TL;DR
This work introduces innsight, an R package that unifies major neural-network feature attribution methods into a single, library- and backend-agnostic workflow. By converting diverse models into a torch-backed representation, it enables gradient-based, LRP, DeepLift, DeepSHAP, and model-agnostic explanations with a consistent three-step pipeline from model to visualization, including tabular, signal, and image data support and interactive plots. The authors validate that innsight’s attributions closely match Python counterparts (captum, zennit, innvestigate, deeplift, shap) within negligible numerical differences, and demonstrate practical use on penguin and melanoma datasets. They also discuss runtime characteristics, limitations (CPU-only, sequential Torch models), and potential extensions (permutation-based methods, broader model support). Overall, innsight provides efficient, accessible, end-to-end interpretability in R, widening the reach of neural network explanations to researchers and practitioners in the R ecosystem.
Abstract
The R package innsight offers a general toolbox for revealing variable-wise interpretations of deep neural networks' predictions with so-called feature attribution methods. Aside from the unified and user-friendly framework, the package stands out in three ways: It is generally the first R package implementing feature attribution methods for neural networks. Secondly, it operates independently of the deep learning library allowing the interpretation of models from any R package, including keras, torch, neuralnet, and even custom models. Despite its flexibility, innsight benefits internally from the torch package's fast and efficient array calculations, which builds on LibTorch $-$ PyTorch's C++ backend $-$ without a Python dependency. Finally, it offers a variety of visualization tools for tabular, signal, image data or a combination of these. Additionally, the plots can be rendered interactively using the plotly package.
