Learn R Programming

nn2poly: Transforming Neural Networks into Polynomials

The nn2poly package implements the NN2Poly method that allows to transform an already trained deep feed-forward fully connected neural network into a polynomial representation that predicts as similar as possible to the original neural network. The obtained polynomial coefficients can be used to explain features (and their interactions) importance in the neural network, therefore working as a tool for interpretability or eXplainable Artificial Intelligence (XAI).

Related Papers:

  • Pablo Morala, J. Alexandra Cifuentes, Rosa E. Lillo, Iñaki Ucar (2021). "Towards a mathematical framework to inform neural network modelling via polynomial regression." Neural Networks, 142, 57-72. doi: 10.1016/j.neunet.2021.04.036

  • Pablo Morala, J. Alexandra Cifuentes, Rosa E. Lillo, Iñaki Ucar (2023). "NN2Poly: A Polynomial Representation for Deep Feed-Forward Artificial Neural Networks." IEEE Transactions on Neural Networks and Learning Systems, (Early Access). doi: 10.1109/TNNLS.2023.3330328

Installation

The latest release version available in CRAN can be installed as:

install.packages("nn2poly")

The installation from GitHub requires the remotes package.

# install.packages("remotes")
remotes::install_github("IBiDat/nn2poly")

Funding

This package is part of the project/grant PDC2022-133359-I00 funded by MCIN/AEI/10.13039/501100011033 and by the European Union “NextGenerationEU/PRTR”.

Copy Link

Version

Install

install.packages('nn2poly')

Monthly Downloads

199

Version

0.1.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Pablo Morala

Last Published

December 12th, 2025

Functions in nn2poly (0.1.3)

plot_taylor_and_activation_potentials

Plots activation potentials and Taylor expansion.
plot_diagonal

Plots a comparison between two sets of points.
luz_model_sequential

Build a luz model composed of a linear stack of layers
reexports

Objects exported from other packages
nn2poly

Obtain polynomial representation
eval_poly

Polynomial evaluation
predict.nn2poly

Predict method for nn2poly objects.
plot.nn2poly

Plot method for nn2poly objects.
add_constraints

Add constraints to a neural network