# Reproduce figures The `paper/` folder of the [ChronoProp repository](https://github.com/Poirazi-Lab/chronoprop) redraws every data figure of the paper (Figs. 2–6 and Supplementary Figs. 1–10) from the archived results of the runs behind it, and prints every number quoted in the legends. Nothing is trained, so a laptop is enough and all figures take under a minute. To train the networks again, use [Run locally](run_locally.md). ## Requirements - Python 3.10 or newer and the ChronoProp package. No GPU. - About 51 MB for the results, downloaded from Zenodo ([10.5281/zenodo.24461579](https://doi.org/10.5281/zenodo.24461579)). - Optionally, for figures identical pixel for pixel to the paper's, the plotting environment of `paper/requirements.txt` (Python 3.11 or 3.12) and the Arial font. Without them every number stays the same and only the rendering differs slightly. ## Quick start ```bash git clone https://github.com/Poirazi-Lab/chronoprop && cd chronoprop pip install -e . pip install -r paper/requirements.txt # optional: the paper's plotting environment python paper/fetch_data.py # the results, about 51 MB python paper/make_figures.py --all # every figure, under a minute ``` `make_figures.py` lists each script as it runs, with its time, and prints the statistics of every figure. The figures go to `paper/figures/` as PDF and PNG (`fig3.pdf` is Fig. 3, `fig3_s4.pdf` is Supplementary Fig. 4), and each figure's statistics to `paper/figures/
_stats.txt`. ## Single figures ```bash python paper/fetch_data.py --fig 3 python paper/make_figures.py --fig 3 ``` | Key | Builds | Runs | Download | |:--|:--|--:|--:| | `2` | Fig. 2, Supplementary Figs. 1–3 | 840 | 5 MB | | `3` | Fig. 3, Supplementary Figs. 4–5 | 800 | 8 MB | | `4` | Fig. 4, Supplementary Fig. 6 | 720 | 7 MB, plus Fig. 3's | | `s7` | Supplementary Fig. 7 (two-compartment neurons) | 240 | 4 MB | | `5` | Fig. 5, Supplementary Fig. 8 | 990 | 9 MB | | `6` | Fig. 6, Supplementary Figs. 9–10 | 1,050 | 19 MB | Fig. 1 is a drawing and has no script. The archives hold all 4,640 runs behind the figures, including every learning rate the paper tried, the SSC runs and the alternatives it tested. [Run locally](run_locally.md) trains only the 1,442 selected networks on SHD, MNIST and Fashion-MNIST. ## How it works For each figure, `make_figures.py` runs the scripts of its folder (`paper/fig3/` for Fig. 3) in order. 1. An aggregator (`aggregate.py`; Fig. 2 does this in its figure script) reads every run and applies the paper's selection rule. For each condition and method it keeps the learning rate with the highest seed mean of peak validation accuracy, and takes each run's test accuracy at its best validation epoch. 2. The figure scripts draw the figure and its supplements. 3. A statistics script (`*_stats.py`) derives every number in the legend from the runs again, separately from the aggregator, so the two check each other. Where a figure shows a neuron's FI curve or plane (Supplementary Fig. 4, Fig. 4a and Supplementary Fig. 7b), its script measures it again with the ChronoProp package and checks it against the fit every run recorded. ## Expected results The statistics are tables with one line per condition. For example, the line behind the headline of Fig. 3, recurrent networks on SHD at Δt = 0.1 ms (validation and test accuracy, mean ± s.d. over 10 seeds, then the paired difference and its test; `tCP` is temporal ChronoProp): ```text cell LR tCP LR BPTT tCP val BPTT val tCP test BPTT test diff t p raw p Holm SHD rec fine 5.0e-04 1.0e-03 96.99± 0.19 73.54± 2.31 80.07± 1.76 63.60± 4.30 +16.46 9.75 4.41e-06 1.76e-05 ``` Before release, every figure was rebuilt from the archives and compared with the code that made the paper. - **Numbers.** Every aggregated table and every printed statistic is identical to the paper's, also with newer numpy and matplotlib (for example numpy 2.0 and matplotlib 3.11). Only the fitted parameters of the Fig. 4 FI plane can move in the eighth digit with the scipy version. - **Figures.** In the environment of `paper/requirements.txt` with Arial, every figure is identical pixel for pixel. Elsewhere the rendering differs slightly (antialiasing, image resampling, sub-millimetre margins), and the paper's margin check prints a warning instead of stopping. ## Data archives `fetch_data.py` checks each archive against its SHA-256 checksum and unpacks it into `paper/data//`. To keep the data elsewhere, set `CHRONOPROP_PAPER_DATA`; to use archives you already downloaded, add `--from `. Each run is one `results.pkl`, as the training code wrote it, in `sim_data////`. It holds the run's settings (`config`), its training, validation and test losses and accuracies per epoch, the FI fit used by ChronoProp, its parameter count and, in most figures, its training time. Fig. 6 adds `perturb_results.pkl`, the accuracy of every network on simulated defective chips. Run folders are named after the settings that differ between runs. Machine names and file paths were removed from the records; nothing else was changed. The folder's [README](https://github.com/Poirazi-Lab/chronoprop/tree/main/paper) describes every file. The method's working name was RateProp, so the records and scripts say `rp` or `rateprop` for ChronoProp, `sg` or `surrogate` for BPTT and `sgplus` for BPTT\*. `ff` and `rec` are the feedforward and recurrent networks, `coarse` and `fine` the timesteps of 1 and 0.1 ms.