Intrinsically explainable neural networks using channel specific prototypes. Code accompanient for Narayanan A and Bergen KJ, Prototype-based Explainable Neural Networks with Channel-specific Reasoning for Geospatial Learning Tasks. (submitted, 2026)
Create a python environment from the environment.yml file
conda env create -f environment.yml
-
Download preprocessed datasets and saved models
Download thedata/folder from the associated Zenodo repository (https://doi.org/10.5281/zenodo.18425035). This folder contains:- The Synthetic MNIST dataset
- The processed MJO dataset used in the study
models/folder with saved models and prototype information for each case study located in their respective subdirectories
-
Download EuroSAT
Download the EuroSAT dataset into thedata/folder using TorchGeo:
https://torchgeo.readthedocs.io/en/latest/api/datasets.html#torchgeo.datasets.EuroSAT -
(Optional) Generate Synthetic MNIST
To generate the Synthetic MNIST dataset from scratch, run:python generate_syntheticMNIST.py
-
**(Optional) Process MJO data from raw .nc files **
To process the MJO data, download raw OLR, U200 and U850 .nc files from https://zenodo.org/records/3968896 (B Toms 2020) into the data/ folder and run:python preprocess_data.py
Each case study includes a Python notebook that loads a trained ML model and reproduces the figures presented in the paper.
- Case Study 1: Synthetic MNIST Classification
- Case Study 2: Madden–Julian Oscillation (MJO) Phase Classification
- Case Study 3: EuroSAT Land-Use Classification
- Notebook for the MJO case study with an added noise channel, as described in the paper
- Notebook for the MNIST_nc case study, which loads a prototype network with joint prototypes across channels (No Channel-Specific Prototypes)
To reproduce the paper figures:
-
Open
model.pyand uncomment the appropriateexp_var_dictcorresponding to the desired case study- For the MNIST_nc experiment, modify
model_nc.pyand useload_mnist_nc.ipynb
- For the MNIST_nc experiment, modify
-
Launch and run the corresponding notebook to generate the figures
Anushka Narayanan, Brown University anushka_narayanan@brown.edu
Data used to replicate findings in this study is freely available. Data used in the MJO classification task can be found at https://zenodo.org/records/3968896 (B Toms 2020). Data used in the land use classification task is obtained from TorchGeo package at Stewart AJ, Robinson C, Corley IA, Ortiz A, Lavista Ferres JM and Banerjee A (2025) TorchGeo: Deep Learning With Geospatial Data. ACM Transactions on Spatial Algorithms and Systems 11(4), 1–28 (https://torchgeo.readthedocs.io/en/latest/api/datasets.html#torchgeo.datasets.EuroSAT).
Code segments from Barnes EA et. al (2022) doi: 10.1175/AIES-D-22-0001.1 and Chen C et al (2019) doi: 10.48550/arXiv.1806.10574 are modified to include channel-specific prototypes