neuralGAM: An R Package for Fitting Generalized Additive Neural Networks
Ines Ortega-Fernandez, Marta Sestelo
TL;DR
This paper presents neuralGAM, an R package implementing Generalized Additive Neural Networks (GANNs) that maintain additive interpretability while leveraging deep neural nets for feature-specific effects. Each covariate is associated with its own neural network, and the additive predictor $E[Y|X] = h^{-1}(\alpha + \sum_{j=1}^p f_j(X_j))$ is learned via local scoring and backfitting, ensuring identifiability with $E[f_j(X_j)]=0$. The package showcases Gaussian and binomial families, demonstrates on simulated data where true function shapes are recovered, and validates on a real-world binary-delay task with NYC flights, achieving competitive predictive performance and clear partial-effect visualizations. Overall, neuralGAM combines interpretability of GAMs with the expressive power of deep learning, offering an accessible, white-box approach for complex prediction tasks with a practical R interface and Python backend via Keras/TensorFlow.
Abstract
Nowadays, Neural Networks are considered one of the most effective methods for various tasks such as anomaly detection, computer-aided disease detection, or natural language processing. However, these networks suffer from the ``black-box'' problem which makes it difficult to understand how they make decisions. In order to solve this issue, an R package called neuralGAM is introduced. This package implements a Neural Network topology based on Generalized Additive Models, allowing to fit an independent Neural Network to estimate the contribution of each feature to the output variable, yielding a highly accurate and interpretable Deep Learning model. The neuralGAM package provides a flexible framework for training Generalized Additive Neural Networks, which does not impose any restrictions on the Neural Network architecture. We illustrate the use of the neuralGAM package in both synthetic and real data examples.
