Skip to main content
Back

Heidelberg Beats RNNs at Heart Diagnosis Using Physics-Borrowed Math

Researchers from Heidelberg University show that Koopman operator features, tuned with radial basis functions, outperform wavelets for multi-class ECG arrhythmia classification when paired with a transformer.

Pro

Paper, Full Access
  • Heidelberg researchers apply the Koopman operator to ECG feature extraction, pairing it with a transformer for arrhythmia classification.
  • Koopman features outperform wavelets on 4-class classification (F1 0.771 vs 0.700), while wavelets lead on binary classification initially.
  • After hyperparameter tuning of the EDMD RBF dictionary, Koopman+Transformer achieves the best overall F1 of 0.786, beating both wavelet and RNN baselines.
  • Naively concatenating wavelet and Koopman features hurts performance badly (4-class F1 drops to 0.533), suggesting the two feature spaces are partially redundant.
  • The Koopman framework also enables interpretable signal reconstruction, linking specific eigenmodes to cardiac events like QRS depolarization and T-wave repolarization.
  • No public code repository is released, but full hyperparameter tables are included in the paper appendix for reproducibility.

A new paper from Heidelberg University takes an unusual route to ECG classification: instead of feeding raw waveforms or spectrograms into a neural network, it first runs the signal through a mathematical framework borrowed from dynamical systems theory, then hands the result to a transformer. The bet pays off, especially when the task gets harder.

Why ECG classification is still an open problem

ECG analysis is vital for detecting cardiac abnormalities, yet robust automated classification is challenging due to the complexity and variability of physiological signals. The heart is a nonlinear dynamical system -- its electrical activity does not follow simple, predictable patterns, and different arrhythmia types can look deceptively similar on a trace. Traditional methods rely on handcrafted time- and frequency-domain features, while deep learning models such as CNNs and RNNs achieve strong performance but face challenges in interpretability and in capturing physiological dynamics.

MIMIC-IV-ECG consists primarily of ten-second 12-lead ECG recordings obtained using clinical-grade hardware and digitized at 500 Hz with 12-bit resolution. The recordings encompass a wide diagnostic spectrum, including arrhythmias (AF, flutter, ectopy), conduction blocks (AVB, BBB), ischemic and nonspecific findings. It has become a standard proving ground for ECG AI, and it is the dataset used here.

Enter the Koopman operator

The core idea behind this work is to reframe the ECG as a dynamical system and extract features that describe its underlying mechanics, rather than its raw shape. The Koopman operator is a mathematical tool that takes a nonlinear dynamical system -- like a heartbeat -- and represents its evolution as a linear operation on a (potentially infinite-dimensional) space of observable functions. In plain terms: instead of tracking how the signal itself changes over time, you track how certain derived measurements of the signal change, and those measurements evolve in a way that can be analyzed with standard linear algebra tools like eigenvalues and eigenvectors.

Extended Dynamic Mode Decomposition (EDMD) extends Dynamic Mode Decomposition by introducing richer dictionaries of basis functions, effectively lifting the data into a higher-dimensional feature space for more accurate linear approximations of dynamics. The paper uses EDMD with a Radial Basis Function (RBF) dictionary -- a set of smooth, bump-shaped functions centered across the signal space -- to approximate the Koopman operator from data. EDMD with the RBF dictionary is used to derive an eigenspectrum that encodes the temporal dynamics of ECG signals, with both the real and imaginary components, along with magnitude and growth rates, used as features.

Architecture diagram showing the hybrid ECG pipeline with parallel Koopman and wavelet feature extraction paths feeding into a transformer encoder

The pipeline, step by step

The experimental setup is clean and systematic. Every variant uses the same transformer encoder at the end; what changes is what goes in.

  1. Preprocessing: Raw 12-lead ECG signals are resampled to a fixed rate, z-score normalized, and segmented into 2-second windows with 50% overlap.
  2. Feature extraction (two paths): Either discrete wavelet transform coefficients (capturing time-frequency structure) or EDMD-derived Koopman eigenspectrum features (capturing dynamical modes).
  3. Transformer encoding: Feature tokens are embedded into a latent space and passed through a 4-layer, 8-head transformer encoder.
  4. Classification head: Aggregated encoder outputs are mapped to class predictions via a linear layer, trained with cross-entropy loss and AdamW.
  5. Reconstruction check: The Koopman modes are also used to reconstruct the original ECG signal, providing a sanity check that the operator actually captured the relevant dynamics.

Five systems were benchmarked: Wavelet+Transformer, Koopman+Transformer, a naive hybrid of both, a tuned Koopman+Transformer (after hyperparameter ablation), and an RNN baseline on raw waveforms.

What the numbers say

The results reveal a nuanced picture that depends heavily on the task difficulty.

MethodBinary F14-Class F1
Wavelet + Transformer0.750 ± 0.020.700 ± 0.03
Koopman + Transformer0.697 ± 0.010.771 ± 0.02
Hybrid (Wavelet + Koopman) + Transformer0.677 ± 0.010.533 ± 0.02
Koopman + Transformer (after ablation)0.786 ± 0.010.764 ± 0.02
RNN baseline (raw ECG)0.782 ± 0.010.700 ± 0.02

Wavelet features excel in binary classification, while Koopman features, when paired with transformers, achieve superior performance in the four-class setting. The most striking result is the tuned Koopman system: after carefully adjusting the EDMD hyperparameters (embedding delay, number of RBF centers, kernel bandwidth, and spectral truncation rank), it achieves the best binary F1 of 0.786, beating both the wavelet baseline and the RNN.

The naive hybrid, on the other hand, is a cautionary tale. A simple hybrid of Koopman and wavelet features does not improve accuracy. In the four-class setting it collapses to F1 = 0.533 -- worse than either component alone. The paper attributes this to redundancy and misalignment between the two feature spaces, which injects noise into the transformer input rather than complementary signal.

Heatmap of Koopman modal amplitudes over time, showing intermittent bright bands aligning with heartbeat events

The interpretability bonus

One of the more compelling aspects of the Koopman approach is what you get beyond classification accuracy. The Koopman framework provides interpretable dynamical patterns, such as oscillatory modes associated with cardiac rhythms. The paper shows that the EDMD reconstruction closely tracks the original ECG waveform, including P-QRS-T morphology and beat-to-beat timing, with small mismatches only at sharp transitions like QRS peaks. The modal amplitude heatmap reveals which Koopman modes correspond to rapid ventricular depolarization (QRS complex) versus slower repolarization (T-wave), giving clinicians a window into what the model is actually using.

This is a meaningful contrast to end-to-end deep learning approaches, where the learned representations are opaque. The Koopman eigenspectrum is physically grounded: eigenvalues near the unit circle with nonzero imaginary parts correspond to persistent oscillations, while those near the real axis capture slowly varying trends. That structure can be inspected and reasoned about.

Limitations and what comes next

The paper is transparent about its constraints:

  • Results are on a single dataset (MIMIC-IV-ECG), so generalization is unproven.
  • Koopman methods are sensitive to hyperparameter choices -- the gains from tuning are large, but so is the search cost.
  • The hybrid approach failed with naive concatenation; more sophisticated fusion (attention-based gating, learned weighting) remains unexplored.
  • Interpretability results have not been validated with clinical experts.

Koopman methods have been successfully applied in fluid dynamics, neuroscience, oscillatory analysis, and time series modeling, but remain underexplored in biomedical signal analysis. The authors suggest the framework could extend naturally to EEG and photoplethysmogram (PPG) signals. No code repository is publicly linked in the paper, but the full paper and appendix include detailed hyperparameter tables that would let practitioners reproduce the setup.

The core takeaway is that the choice of EDMD dictionary matters enormously -- more than the choice of architecture. A well-tuned RBF dictionary with the right embedding dimension and spectral truncation transforms a mediocre Koopman feature set into the best-performing system in the benchmark. For anyone working on physiological time-series classification, that is a concrete and actionable finding.