This repository contains the code and datasets for the paper:
"Faithful to What?" On the Limits of Fidelity-Based Explanations
Jackson Eshbaugh, Department of Computer Science, Lafayette College, January 2026
Neural network outputs can often be well-approximated by linear models—but what does that tell us?
This project introduces the linearity score λ(f), a simple diagnostic that measures how well a regression network’s input–output behavior can be approximated by a linear model. We show that high linear fidelity to a network does not necessarily imply high task accuracy, highlighting a gap between being faithful to a model and being faithful to the underlying data-generating signal.
Let
$ \lambda(f) := R^2(f, g^) = 1 - \frac{\mathbb{E}[(f(x) - g^(x))^2]}{\text{Var}(f(x))} $
where $ g^* = \arg\min_{g \in \mathcal{L}} \mathbb{E}[(f(x) - g(x))^2]$.
In other words,
All experiments and visualizations in the paper are contained in:
📓 lambda_linearity_score.ipynb
The notebook is fully self-contained and organized into:
- A reusable experimental framework
- Four datasets (synthetic + 2 real-world)
- Plots and tabulated results
To use build_network() function and rerun the provided pipeline.
- Synthetic:
$y = x \cdot \sin(x) + \varepsilon$ , where$\varepsilon \sim \mathcal{N}(0, \sigma^2)$ - Medical Cost Personal Dataset (Kaggle)
- California Housing (scikit-learn)
To run the notebook, install the following Python packages:
pip install tensorflow scikit-learn matplotlib pandas seaborn kagglehubTested with Python 3.11.
Special thanks to Professor Jorge Silveyra for the early discussions that helped spark this project.
© 2026 Jackson Eshbaugh • Lafayette College • Released under the MIT License.