SCE 513 · Systems Identification · Final presentation
Deep Koopman-Based Reachability Analysis for Data-Driven Predictive Control of Unknown Nonlinear Systems
A Python reproduction of Algorithm 1 (Ketema et al., 2025) and a calibrated-tube extension for MPC
Supervisor: Prof. Mujahed Al Dhaifallah
Ketema, Tilahun, Zawka & Geletu · IFAC J. Syst. Control 34 (2025) 100339
→ next · N notes · P presenter view · F full screen
The reproduction
Objective: re-implement the paper's reachability method in Python and test its claims on held-out data.
Where can an unknown plant's output go next?

The problem
- u,yUnknown plant. We don't have the equations, just recorded inputs u and outputs y with bounded noise.
- RGoal: an output tube R1 … RP that contains y(k), for the next P steps, so a model predictive controller (MPC) can keep its constraints. It must be valid (contains the true output) and tight (as narrow as possible).
The paper's recipe · Ketema et al., 2025
Lift
An LSTM maps a window of past (u, y) to observables Φ, features in which the dynamics are approximately linear
Fit
EDMD (extended dynamic mode decomposition) fits, by least squares, a linear model Φ⁺ = AΦ + Bu, y = HΦΦ; Φ⁺ is the next lifted state, HΦ maps it back to the outputs
Propagate
Algorithm 1 propagates zonotopes through the model to get the output sets
Algorithm 1: lift the set, propagate it, inflate by the uncertainty

Lift the output set into Φ

The pseudo-inverse HΦ+ only recovers 2 of the lifted directions, so the other get a ±σ box. The paper uses σ = .
Step forward, then pad

One linear Koopman step, then Minkowski sums (⊕) with process noise, sensor noise and Zδ, which we read as the min–max box of the training residuals.
→RΦkline 7
→Ryk+1repeat for k = 0 … P−1
Notation · Ryk, RΦk: output and lifted sets at step k · K = [A B]: Koopman matrices · Zu: input set · Zθ, ZωΦ: sensor and process noise · Pnull = I − HΦ+HΦ: directions the outputs cannot see · Zσ: the ±σ box.
This is the actual code from reachability.py, pulled in when the deck is built, so the line numbers are real.
Reproduction pipeline: one command, fixed seed, bit-exact re-runs

generate
CSTR · traj. × steps
trajectories.npzsplit
by trajectory:
split.npztrain
LSTM lifter; EDMD solved in closed form inside the loss
best.ptsweep
configs, picked on validation
T1 · F2evaluate
test split only, enforced by a guard in the script
T2 · T3 · F3 · F8reach
Algorithm 1 at σ = and σ = 0
T4 · F4figures
all figures made from saved results
results/figuresdata.py
edmd.py
metrics.py
reachability.py
1Plant repaired
The equations as printed overflow (e427), so I ported cstrDiscr from the CORA reachability toolbox, the model both papers actually simulate.
2Held-out protocol
The paper doesn't use test data. I split by trajectory and read the test split only once.
3Own zonotope algebra
I wrote it in NumPy and checked it against another library (pypolycontain) in tests.
4Reproducible
tests; a clean re-run is bit-exact. Every choice the paper leaves open is documented: deviations from the paper.
How the code is organised: one package, seven layers

L6Studies & reporting
scripts/01–06 + run_pipeline.pyscripts/07–19 · study.pyreports & paper: tables from codeL5MPC use & stress tests
L4Calibrated tubes
calib.py · tube buildersconformal_tubes/ · numpy-only libraryL3Set-based reachability
zonotope.py · checked vs pypolycontainreachability.py · Lemma 1 + Algorithm 1L2Validation
itmf.py · information-theoretic checks: MI, ΔH, KLmetrics.py · 1-step & free-run accuracyL1Predictors
edmd.pylstm_koopman.pyseq2seq.pyARX · poly-EDMDL0Plants & data
system.py · CORA cstrDiscrdata.py · split, windows, z-scoreconfigs/default.yaml5 more plants + measured tanksIdentification: test error at the measurement-noise floor


Test trajectory #0, y1 top, y2 bottom: measured ▲, Koopman one-step ○ and free run (blue), output-centric model (orange).
Scorecard: what reproduced and what didn't

| Paper figure or claim | Paper | This reproduction | Status |
|---|---|---|---|
| Fig. 2 · loss vs hyper-parameters | flat field | flat, one outlier ( networks) | Trend reproduced |
| Fig. 3 · mutual information | significant | significant for all state–observable pairs | Reproduced |
| Fig. 3 · entropy difference, KL | constant along rows | varies with the observable | Not reproduced |
| Fig. 4 · containment | outputs inside the sets | 100 % at every step, also held-out | Reproduced |
| Fig. 4 · set size | half-width ≈ in y2 | at σ = (one step) | Not reproduced |
| Accuracy on test data (R2) | not reported | noise floor, R2 > | New result |
At σ = every output is contained, but the sets are wide

Checked exactly (LP) at σ = 0. The sets only get bigger as σ grows, so it holds for every σ. Containment is guaranteed by construction.
The extension
If every predictor carries the same 95 % guarantee, does deep Koopman lifting give tighter output tubes?
One calibrated number κ turns any predictor into a 95 % tube

Predict

Each predictor returns a centre ck, a fixed width ak and a scalable width bk, for k = 1 … P.
Score

For each of N = new trajectories, the score s is the smallest κ whose tube covers all P outputs.
Calibrate (split conformal)
κ̂ = the smallest of the scores (ε = 0.05). Analogy: a courier quoting a 95 % delivery time from past deliveries.
Guarantee

Covers the whole trajectory, for any predictor. Assumptions: marginal (on average over runs), exchangeable data, open loop.
This is all the code the guarantee needs, numpy only: src/conformal_tubes/core.py, also released as the conformal-tubes package.
Predictors compared: ARX (linear, past window) · B3 (deep Koopman, ours) · poly-EDMD (polynomial features) · seq2seq (LSTM, all P steps at once) · Algorithm 1 (lean reading).
Same coverage guarantee, very different tubes

Half-width: tube radius in z-score units, lower is tighter. Coverage: share of test trajectories inside the tube at every step.
The catch with the tightest tube: fragile coverage, harder MPC

Coverage under bang-bang inputs (extremes only)
Calibrated on the training input law, tested on bang-bang inputs · mean of plants × seeds · ○ worst plant
Without the shift all three are on target: ARX , B3 , seq2seq . Only seq2seq loses its guarantee when the inputs change.
Closed-loop tube MPC on Van der Pol · x1 ≤
seeds × episodes · violations without a tube (nominal) → with the calibrated tube
| Model | Violating episodes | Cost increase |
|---|
open-loop coverage of the seq2seq tube on closed-loop data (B3 , ARX )
What I take away

01Reproduction
- Identification reproduced, with noise-level accuracy and a stable free run.
- Containment reproduced (100 %), but it holds by construction.
- Set size not reproduced. It's driven by σ‖HΦAPnull‖, which the paper doesn't report.
02Extension
- Calibrate first, and only compare widths at the same coverage.
- On near-affine plants, plain ARX is enough.
- On nonlinear plants, deep prediction helps more than deep lifting, but you lose some robustness and convexity.
Thank you. Questions?