memdyn 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
memdyn-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aurélien Pélissier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
memdyn-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,340 @@
1
+ Metadata-Version: 2.4
2
+ Name: memdyn
3
+ Version: 0.1.0
4
+ Summary: MemDyn (Memory-augmented Dynamics): continuous-time interacting network dynamics with source-isolated unit-DC-gain adaptive memory, explicit interaction weights, and orthogonal latent corrections in JAX.
5
+ Author-email: Aurélien Pélissier <aurelien.pelissier.38@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/AI-MathPhys/MemDyn
8
+ Project-URL: Repository, https://github.com/AI-MathPhys/MemDyn
9
+ Project-URL: Issues, https://github.com/AI-MathPhys/MemDyn/issues
10
+ Project-URL: Paper, https://github.com/AI-MathPhys/MemDyn/blob/main/manuscript/MemDyn_manuscript.pdf
11
+ Project-URL: Reproducibility, https://github.com/AI-MathPhys/MemDyn/blob/main/REPRODUCIBILITY.md
12
+ Keywords: dynamical-systems,neural-ode,state-space-models,non-markovian,adaptive-memory,hysteresis,causal-discovery,system-identification,interacting-networks,perturb-seq,gene-regulatory-networks,liquid-time-constant,jax
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
23
+ Classifier: Topic :: Scientific/Engineering :: Physics
24
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: jax>=0.4.25
29
+ Requires-Dist: numpy>=1.26
30
+ Requires-Dist: scipy>=1.12
31
+ Provides-Extra: experiments
32
+ Requires-Dist: matplotlib>=3.8; extra == "experiments"
33
+ Requires-Dist: pandas>=2.1; extra == "experiments"
34
+ Requires-Dist: pyarrow>=14.0; extra == "experiments"
35
+ Requires-Dist: requests>=2.31; extra == "experiments"
36
+ Requires-Dist: scikit-learn>=1.4; extra == "experiments"
37
+ Requires-Dist: anndata>=0.10; extra == "experiments"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0; extra == "dev"
40
+ Requires-Dist: ruff>=0.4; extra == "dev"
41
+ Requires-Dist: build>=1.2; extra == "dev"
42
+ Requires-Dist: twine>=5.0; extra == "dev"
43
+ Provides-Extra: all
44
+ Requires-Dist: memdyn[dev,experiments]; extra == "all"
45
+ Dynamic: license-file
46
+
47
+ # MemDyn: Memory-Augmented Dynamics (`memdyn`)
48
+
49
+ [![PyPI](https://img.shields.io/pypi/v/memdyn.svg)](https://pypi.org/project/memdyn/)
50
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/AI-MathPhys/MemDyn/blob/main/LICENSE)
51
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://github.com/AI-MathPhys/MemDyn/blob/main/pyproject.toml)
52
+ [![JAX](https://img.shields.io/badge/backend-JAX-orange.svg)](https://github.com/AI-MathPhys/MemDyn/blob/main/pyproject.toml)
53
+ [![Manuscript](https://img.shields.io/badge/Manuscript-PDF-red.svg)](https://github.com/AI-MathPhys/MemDyn/blob/main/manuscript/MemDyn_manuscript.pdf)
54
+
55
+ Pure-Python library (`memdyn`) built on **JAX**, **NumPy**, and **SciPy** for learning interpretable, continuous-time interacting dynamical systems with **source-isolated, unit-DC-gain adaptive memory**. Includes the complete experimental suite (`experiments/`), checksum-verified dataset collector (`experiments/fetch_data.py`), 22 SHA-256-locked result archives (`results/`), publication figures (`figures/`), and LaTeX benchmark tables (`output/tables/`) accompanying:
56
+
57
+ > **MemDyn: Learning Interacting Dynamical Systems with Source-Isolated Adaptive Memory**
58
+ > Aurélien Pélissier · [Manuscript PDF (40 pp.)](https://github.com/AI-MathPhys/MemDyn/blob/main/manuscript/MemDyn_manuscript.pdf) · [Reproducibility Map](https://github.com/AI-MathPhys/MemDyn/blob/main/REPRODUCIBILITY.md) · [Dataset Licenses](https://github.com/AI-MathPhys/MemDyn/blob/main/DATA_LICENSES.md)
59
+
60
+ <p align="center">
61
+ <img src="https://raw.githubusercontent.com/AI-MathPhys/MemDyn/main/figures/MemDyn_overview.png" width="95%" alt="MemDyn: Modeling History-Dependent Network Dynamics"/>
62
+ </p>
63
+
64
+ <p align="center">
65
+ <img src="https://raw.githubusercontent.com/AI-MathPhys/MemDyn/main/figures/MemDyn_Figure1_architecture.png" width="95%" alt="Figure 1: MemDyn structural separation of adaptive memory and network interactions"/>
66
+ </p>
67
+
68
+ *Figure 1 — **MemDyn** separates source-local adaptive temporal memory from explicit network interactions (**a**). Each source evolves private, normalized two-stage memory channels $(z_{ir}, h_{ir})$ governed by bounded neural rate functions $(\lambda^{(1)}_{ir}, \lambda^{(2)}_{ir})(a_i, z_{ir}, h_{ir})$ (**b**), feeding signed direct ($D_{ij}$), delayed ($B_{irj}$), and diagonal-free sparse pairwise ($\Gamma_{ikj}$) interaction weights—yielding conditional source isolation, unit steady-state gain, intervention-based clamp identification, and global boundedness (**c**). All main and supplementary figures are included in [`figures/`](https://github.com/AI-MathPhys/MemDyn/tree/main/figures).*
69
+
70
+ ---
71
+
72
+ ## What `memdyn` Provides
73
+
74
+ For a network of $S$ source drives $g_i(t)$ (bounded via $a_i = \tanh(g_i)$) influencing $N$ observed target states $y_j(t)$, **MemDyn** isolates nonlinear loading and recovery kinetics inside private two-stage channels ($r = 1, \dots, R$):
75
+
76
+ $$
77
+ \dot{z}_{ir} = \lambda^{(1)}_{ir}(a_i, z_{ir}, h_{ir})(a_i - z_{ir}), \qquad
78
+ \dot{h}_{ir} = \lambda^{(2)}_{ir}(a_i, z_{ir}, h_{ir})(z_{ir} - h_{ir})
79
+ $$
80
+
81
+ while confining cross-source integration to explicit interaction weights:
82
+
83
+ $$
84
+ \dot{y}_j = \sum_{i=1}^{S} D_{ij} a_i + \sum_{i=1}^{S}\sum_{r=1}^{R} B_{irj} h_{ir} + \sum_{1 \le i < k \le S} \Gamma_{ikj} \bar{h}_i \bar{h}_k - \delta_j y_j.
85
+ $$
86
+
87
+ Key capabilities in `src/memdyn/`:
88
+
89
+ - **Driven open-loop dynamics (`MemDynModel`):** Source-isolated adaptive two-stage memory with symmetric-base plus stage-asymmetry residual rate laws, optional diagonal-free low-rank pairwise cooperativity $\Gamma$, low-rank delayed readouts $O((S+N)K_m)$, and counterfactual source attribution $\Delta_{i \to j}(t) = y(u) - y(u_{-i})$.
90
+ - **Autonomous closed-loop networks (`ClosedLoopMemDyn`):** Recurrent feedback $g_i(t) = (1 - \mathrm{ko}_i)\gamma_i y_i(t) - \mathrm{ko}_i \gamma_i y_{i,\mathrm{basal}} + u_i(t)$ supporting zero-shot combinatorial interventions, warm-start teacher-forced clamping (`clamp_steps`), optional diagonal self-memory (`self_memory=True`), strict $O(B(SR+N)K_r)$ rank-factorized hollow readouts, and directed interaction discovery.
91
+ - **Partial observability (`MemDynOrtho`):** Two-stage residual orthogonalization that freezes the learned observed-source branch (**exact `0.0%` Stage-1 drift**) and appends an $L^2(\mathbb{P}_{\mathrm{train}})$-orthogonalized latent neural ODE with validation-selected shrinkage $\beta \in [0, 1]$.
92
+ - **Gauge-invariant hysteresis portraits (`compute_hysteresis_portrait`):** Simulated RK4 step-on / step-off half-times $(\tau_{1/2}^{\mathrm{on}}, \tau_{1/2}^{\mathrm{off}})$ and asymmetry ratio $\mathcal{H}_i = \tau_{1/2}^{\mathrm{off}} / \tau_{1/2}^{\mathrm{on}}$ (identically `1.000` for any linear constant-rate two-stage cascade, even when $\lambda^{(1)} \neq \lambda^{(2)}$).
93
+ - **Linear $O(SR)$ memory scaling:** At fixed channel count $R$, private memory parameters grow strictly linearly in $S$ (`15.4k` memory / `1.18M` total params at $S=512, N=2{,}048$ vs. `808k` / `5.01M` for Coupled Adaptive).
94
+ - **Matched baseline suites (`baselines.py`, `discrete_baselines.py`):** 16 continuous-time open-loop families, 10 closed-loop families (including `Depthwise SSM`, `Mamba` / selective SSM, `Source-Local LTC`, `Coupled LTC`, `CfC`, `Neural CDE`, `PerturbODE`, `Latent ODE`, `MEMDYN_UNPROJ`), plus pure-JAX `DLinear`, `GRU`, and causal `Temporal Transformer` baselines.
95
+ - **Theory & intervention design (`theory.py`, `identification.py`):** Deterministic audits of Theorem 1(i)–(iii), Proposition 1(i)–(iii), and Theorem 2 counterbalanced $4{:}1$ strength-swap identifiability with $\mathrm{AR}(1)$ innovation dynamic programming.
96
+
97
+ ---
98
+
99
+ ## Installation
100
+
101
+ Requires **Python 3.11+**. Core runtime dependencies are **`jax>=0.4.25`**, **`numpy>=1.26`**, and **`scipy>=1.12`**. The published wheel contains **only** `src/memdyn/` (experiment scripts, result archives, figures, and manuscript PDF remain outside the wheel).
102
+
103
+ ```bash
104
+ # Install the library from PyPI
105
+ pip install memdyn
106
+
107
+ # Or install the latest commit from GitHub
108
+ pip install "git+https://github.com/AI-MathPhys/MemDyn.git"
109
+ ```
110
+
111
+ Optional extras:
112
+
113
+ ```bash
114
+ pip install "memdyn[experiments]" # matplotlib, pandas, pyarrow, requests, scikit-learn, anndata
115
+ pip install "memdyn[dev]" # pytest, ruff, build, twine
116
+ pip install "memdyn[all]" # all optional dependencies
117
+ ```
118
+
119
+ ### Local Clone for Development & Paper Reproduction
120
+
121
+ ```bash
122
+ git clone https://github.com/AI-MathPhys/MemDyn.git
123
+ cd MemDyn
124
+ python -m venv .venv && source .venv/bin/activate
125
+ python -m pip install -e ".[all]"
126
+
127
+ # Check installed versions and run the fast (<2 s) numerical self-test
128
+ memdyn-info --check
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Quickstart
134
+
135
+ ### 1. Open-Loop Driven Network, Attribution & Hysteresis Portrait (`MemDynModel`)
136
+
137
+ ```python
138
+ import numpy as np
139
+ from memdyn import MemDynModel
140
+
141
+ # Inputs u: (batch, n_times, n_sources), targets y: (batch, n_times, n_targets)
142
+ model = MemDynModel(n_channels=3, hidden_width=4, cooperativity=True)
143
+ model.fit(
144
+ train_u, train_y,
145
+ dt=0.25,
146
+ substeps=4,
147
+ val_data=(val_u, val_y),
148
+ seeds=(101, 202),
149
+ reg_grid=(1e-4, 1e-3, 1e-2),
150
+ total_updates=400,
151
+ )
152
+
153
+ y_hat = model.predict(test_u, y0=test_y[:, 0, :]) # (B, T, N)
154
+ effects = model.attribute(test_u, y0=test_y[:, 0, :]) # (S, B, T, N) counterfactual Delta_{i->j}(t)
155
+ weights = model.interaction_weights() # signed direct D, delayed B, total D + sum_r B
156
+ portrait = model.hysteresis_portrait(time_unit_scale=1.0) # tau_on, tau_off, H = tau_off / tau_on
157
+ print("Hysteresis ratios H:", np.round(portrait.hysteresis_ratio, 3))
158
+ ```
159
+
160
+ ### 2. Autonomous Closed-Loop Network & Zero-Shot Combinatorial Knockouts (`ClosedLoopMemDyn`)
161
+
162
+ ```python
163
+ from memdyn import ClosedLoopMemDyn
164
+
165
+ # Train on wild-type + single-node knockouts (B, T, N) with ko_mask in [0, 1]^(B, N)
166
+ cl = ClosedLoopMemDyn(n_channels=3, hollow=True, self_memory=False, cooperativity=False)
167
+ cl.fit(train_y, dt=0.25, substeps=2, ko_mask=train_ko, basal_levels=basal, total_updates=400)
168
+
169
+ # Zero-shot rollout on unseen double knockouts (no future node traces supplied)
170
+ pred_double_ko = cl.predict(test_double_ko)
171
+ causal_graph = cl.interaction_matrix # (N, N) directed counterfactual sensitivity matrix
172
+ ```
173
+
174
+ ### 3. Partial Observability with Frozen Stage-1 Attribution (`MemDynOrtho`)
175
+
176
+ ```python
177
+ from memdyn import MemDynOrtho
178
+
179
+ ortho = MemDynOrtho(base_kwargs={"n_channels": 3, "hidden_width": 5}, latent_dim=12)
180
+ ortho.fit(train_u_obs, train_y, dt=0.25, val_data=(val_u_obs, val_y), total_updates=400)
181
+
182
+ y_total = ortho.predict(test_u_obs, y0=test_y[:, 0, :]) # y_obs + beta * y_lat_perp
183
+ y_stage1 = ortho.predict_observed(test_u_obs, y0=test_y[:, 0, :])# exact 0.0% Stage-1 drift
184
+ attr_full = ortho.attribute(test_u_obs, observed_only=False)
185
+ ```
186
+
187
+ Runnable scripts in [`examples/`](https://github.com/AI-MathPhys/MemDyn/tree/main/examples):
188
+ - [`quickstart_open_loop.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/examples/quickstart_open_loop.py) — Driven `MemDynModel` fitting, counterfactual attribution, and gauge-invariant hysteresis ratios.
189
+ - [`quickstart_closed_loop.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/examples/quickstart_closed_loop.py) — Cyclic `ClosedLoopMemDyn` trained on single KOs and evaluated zero-shot on double KOs.
190
+ - [`quickstart_memdyn_ortho.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/examples/quickstart_memdyn_ortho.py) — Partially observed `MemDynOrtho` demonstrating exact `0.0%` Stage-1 drift.
191
+
192
+ ---
193
+
194
+ ## Library Modules (`src/memdyn/`)
195
+
196
+ | Module | Scope | Key Public Exports |
197
+ | :--- | :--- | :--- |
198
+ | [`api.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/api.py) | High-level ergonomic API | `MemDynModel`, `ClosedLoopMemDyn`, `MemDynOrtho`, `HysteresisPortrait`, `compute_hysteresis_portrait`, `build_stage_grid` |
199
+ | [`dynamics.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/dynamics.py) | Reference NumPy RK4 & midpoint ODEs | `MemDynConfig`, `MemDynParams`, `RateInputMode`, `rollout_memdyn_rk4`, `rollout_closed_loop_memdyn_rk4`, `compute_exact_contributions`, `memory_reset_splice_decomposition`, `project_orthogonal_cofactor_basis` |
200
+ | [`baselines.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/baselines.py) | Differentiable JAX continuous-time suite | `DynamicalModelFamily` (16 families), `ClosedLoopModelFamily` (10 families), `ModelSpec`, `ClosedLoopSpec`, `build_jax_rollout`, `build_closed_loop_jax_rollout`, `fit_dynamical_model`, `fit_closed_loop_network`, `fit_two_stage_memdyn_ortho`, `counterfactual_source_attribution` |
201
+ | [`discrete_baselines.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/discrete_baselines.py) | Pure-JAX discrete comparators | `DiscreteModelFamily` (`DLINEAR`, `GRU`, `TRANSFORMER`), `fit_discrete_open_loop`, `fit_discrete_closed_loop`, `discrete_counterfactual_attribution` |
202
+ | [`theory.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/theory.py) | Numerical theorem & corollary audits | `verify_general_s_covariance_crosstalk_theorem`, `verify_selective_ssm_crosstalk_corollary`, `verify_closed_loop_stability_and_identifiability_theorem`, `verify_unit_dc_gain_and_second_order_vs_local_ltc`, `verify_iso_expression_proposition`, `verify_orthogonal_cofactor_invariance_proposition`, `verify_ortho_ood_generalization_theorem` |
203
+ | [`identification.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/identification.py) | Theorem 2 swap & schedule design | `swap_singular_values`, `invert_swap_waveforms`, `exact_swap_cancellation_accuracy`, `template_margin_lower_bound`, `ar1_innovation_schedule_bound`, `paired_schedule_certificate` |
204
+ | [`training.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/training.py) | Frozen-readout JAX rate trainer | `FrozenReadoutParams`, `make_rate_starts`, `build_jax_frozen_readout_solver`, `fit_frozen_readout_rates` |
205
+ | [`multitf_benchmark.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/multitf_benchmark.py) | 8-source correlation-shift generator | `MultiTFWorld`, `generate_multitf_world` |
206
+ | [`powergrid.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/powergrid.py) | IEEE 39-bus Kron-reduced simulator | `PowerGridWorld`, `compute_ieee39_kron_admittance`, `generate_ieee39_powergrid_world` |
207
+ | [`simulators.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/simulators.py) | Occupancy & mass-action buffers | `SyntheticNetwork`, `build_synthetic_network`, `simulate_occupancy_network`, `simulate_buffered_network` |
208
+ | [`datasets.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/datasets.py) | Biological dataset loaders | `fetch_and_prepare_hipsc_perturbseq`, `fetch_and_prepare_marson_cd4t_perturbseq`, `fetch_and_prepare_emt_withdrawal`, Msn2, macrophage & NF-κB loaders |
209
+ | [`cross_domain_datasets.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/cross_domain_datasets.py) | Physical/social/financial loaders | `load_beijing_air_quality`, `load_metr_la_traffic`, `load_binance_market_contagion`, `load_reddit_temporal_network` |
210
+ | [`cli.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/src/memdyn/cli.py) | Diagnostic CLI | `memdyn-info [--check]` / `python -m memdyn [--check]` |
211
+
212
+ ---
213
+
214
+ ## Reproducing Paper Results (`experiments/`)
215
+
216
+ All paper data-collection, verification, benchmark, and figure/table scripts live under [`experiments/`](https://github.com/AI-MathPhys/MemDyn/tree/main/experiments) and import directly from `memdyn`. See [`REPRODUCIBILITY.md`](https://github.com/AI-MathPhys/MemDyn/blob/main/REPRODUCIBILITY.md) for the exact claim-to-script-and-archive mapping.
217
+
218
+ ### Step 1 — Verify Archived Claims, Theorems & Unit Tests (No Downloads Required)
219
+
220
+ ```bash
221
+ # Verify all 22 SHA-256 design locks, 19 claim-ledger files & live double-precision Msn2 RK4 replays (~2 s)
222
+ python -m experiments.run_suite --group reproduce
223
+
224
+ # Deterministic numerical proof verification (Theorem 1, Proposition 1, Theorem 2; ~2 s)
225
+ python -m experiments.run_suite --group verify
226
+
227
+ # Rebuild all 19 LaTeX benchmark tables (output/tables/) & diagnostic panels (output/figures/)
228
+ python -m experiments.run_suite --group figures
229
+
230
+ # Run the full pytest suite
231
+ pytest -q
232
+ ```
233
+
234
+ ### Step 2 — Collect Public Empirical Datasets (Required Only to Re-Run From Raw Data)
235
+
236
+ Raw third-party datasets are **not** redistributed in this repository; each remains governed by its upstream license in [`DATA_LICENSES.md`](https://github.com/AI-MathPhys/MemDyn/blob/main/DATA_LICENSES.md). Use [`experiments/fetch_data.py`](https://github.com/AI-MathPhys/MemDyn/blob/main/experiments/fetch_data.py) to inspect licenses, download from official upstream hosts, and verify SHA-256 checksums:
237
+
238
+ ```bash
239
+ # Inspect all 10 datasets, sizes, and upstream license terms
240
+ python -m experiments.fetch_data --list
241
+ python -m experiments.fetch_data --licenses
242
+
243
+ # Download standard auto-fetchable datasets (~1.0 GB total; excludes 16 GB GSE314342)
244
+ python -m experiments.fetch_data --all-auto --accept-licenses
245
+
246
+ # Optional: download ONLY permissively licensed datasets (CC BY / MIT / open GEO)
247
+ python -m experiments.fetch_data --all-auto --only-permissive --accept-licenses
248
+
249
+ # Optional: download the 16 GB primary human CD4+ T-cell CRISPRi screen (GSE314342)
250
+ python -m experiments.fetch_data --dataset marson_cd4t --accept-licenses
251
+
252
+ # Verify checksums of already-downloaded files
253
+ python -m experiments.fetch_data --verify-only
254
+
255
+ # Optional: point experiment scripts to a custom data directory
256
+ eval "$(python -m experiments.fetch_data --data-dir /path/to/raw --env)"
257
+ ```
258
+
259
+ ### Step 3 — Re-Run Benchmark Suites or Individual Scripts
260
+
261
+ ```bash
262
+ # List all groups and scripts
263
+ python -m experiments.run_suite --list
264
+
265
+ # Primary matched-budget benchmark suites + gauge-invariant hysteresis portraits
266
+ python -m experiments.run_suite --group core
267
+
268
+ # Controlled cyclic double-KO, sensitivity ablations, and trajectory exports
269
+ python -m experiments.run_suite --group controlled
270
+
271
+ # Standalone biological suites (hiPSC, yeast cross-readout/LOPO, macrophage, NF-kB)
272
+ python -m experiments.run_suite --group biology
273
+
274
+ # Or run a single script
275
+ python -m experiments.run_suite --script run_cyclic_double_ko.py
276
+ ```
277
+
278
+ ---
279
+
280
+ ## Summary of Main Paper Benchmarks
281
+
282
+ Selected cross-domain trajectory prediction MSE values under matched task protocols (lower is better; complete multi-model tables & two-sided Holm–Bonferroni tests in `output/tables/` and Appendix D):
283
+
284
+ | Task | MemDyn MSE | Reference Model | Reference MSE | Highlight |
285
+ | :--- | ---: | :--- | ---: | :--- |
286
+ | **Cyclic 12-world 2-KO** (0-shot) | **0.0503** | Local Constant | 0.0623 | −19.2% vs. Local Const; −73–77% vs. Mamba/CfC/LTC/PerturbODE |
287
+ | **Beijing AQ** (4-season LOSO, Δ*u*) | 0.498 | CfC (fixed) | **0.493** | Every ODE (`0.493–0.522`) beats all discrete baselines (`0.531–0.566`) |
288
+ | **METR-LA** (*S* = 207, 1-h rollout) | **0.1309** | Local Constant (+sm) | 0.1318 | #1 of 15 models; 18.7× fewer memory params than Coupled Adaptive |
289
+ | **IEEE 39-bus ODE** (*N*−2 outage) | **0.0259** | Local Constant (+sm) | **0.0259** | −27% vs. Latent ODE (`0.0355`); 0.897 corridor AUROC |
290
+ | **Binance** (16 assets, Aug 2024) | 1.007 | DLinear (discrete) | **0.807** | Hidden BTC+ETH PO: **MemDyn-Ortho leads all ODEs (`0.954`)** |
291
+ | **SNAP Reddit** (non-overlapping) | 1.119 | DLinear (discrete) | **0.8591** | Fixed-grid weekly lags favor DLinear (near-chance graph AUROC) |
292
+ | **Human CD4⁺ T cells** (*S* = 128) | 0.6472 | Regularized ODEs | 0.6469–0.6472 | **1.27× raw CollecTRI AP** (vs. 1.14× Mamba, 1.10× Depthwise SSM) |
293
+ | **Human EMT withdrawal** (`GSE147405`) | 0.276 | Depthwise SSM (+Γ) | **0.260** | MemDyn-Ortho `0.271` (within 0.25 SE) |
294
+ | **Yeast Msn2** (10 unseen trains) | 0.0346 | Coupled Adaptive | **0.0223** | Unsupervised chromatin washout: **84.0 vs. 48.1 min** (`1.75×`) |
295
+ | **6-of-8 Partial Obs.** (12 worlds) | **0.2884** (`Ortho`) | MemDyn (obs. only) | 0.3457 | Full-model attr. RMSE **0.1689** (vs. 0.1856 unproj., 0.0% S1 drift) |
296
+
297
+ <p align="center">
298
+ <img src="https://raw.githubusercontent.com/AI-MathPhys/MemDyn/main/figures/MemDyn_Figure2_summary.png" width="95%" alt="Figure 2: Nine-panel empirical validation summary of MemDyn"/>
299
+ </p>
300
+
301
+ ---
302
+
303
+ ## Repository Structure
304
+
305
+ ```text
306
+ MemDyn/
307
+ ├── src/memdyn/ # Lean installable JAX/NumPy/SciPy library (15 modules + py.typed)
308
+ ├── experiments/ # Paper reproduction suite: fetch_data.py, run_suite.py, verify_theory.py,
309
+ │ └── legacy/ # reproduce_all.py, build_paper_assets.py, fair suites & legacy scripts
310
+ ├── examples/ # 3 runnable library quickstarts (open-loop, closed-loop, MemDyn-Ortho)
311
+ ├── tests/ # Pytest unit, API, gradient-flow, theory & SHA-256 reproducibility tests
312
+ ├── results/ # 22 SHA-256 design_lock.json manifests, claim_ledger.json & score archives
313
+ ├── figures/ # Main (overview, Fig. 1, Fig. 2) & supplementary manuscript figures
314
+ ├── output/tables/ # Generated LaTeX benchmark tables (.tex)
315
+ ├── manuscript/ # Compiled 40-page MemDyn manuscript PDF
316
+ ├── CITATION.cff # Machine-readable citation metadata
317
+ ├── DATA_LICENSES.md # Upstream dataset licenses, DOIs & terms of use
318
+ ├── REPRODUCIBILITY.md # Complete theorem / figure / table -> script & archive map
319
+ ├── pyproject.toml # PEP 621 `memdyn` pip package definition
320
+ └── LICENSE # MIT License
321
+ ```
322
+
323
+ ---
324
+
325
+ ## Citation
326
+
327
+ ```bibtex
328
+ @article{pelissier2026memdyn,
329
+ title = {MemDyn: Learning Interacting Dynamical Systems with Source-Isolated Adaptive Memory},
330
+ author = {P{\'e}lissier, Aur{\'e}lien},
331
+ year = {2026},
332
+ url = {https://github.com/AI-MathPhys/MemDyn}
333
+ }
334
+ ```
335
+
336
+ Machine-readable citation metadata is provided in [`CITATION.cff`](https://github.com/AI-MathPhys/MemDyn/blob/main/CITATION.cff).
337
+
338
+ ## License
339
+
340
+ Released under the [MIT License](https://github.com/AI-MathPhys/MemDyn/blob/main/LICENSE).