Finding where a seizure starts by how brain signals switch, not just how loud they get
Before epilepsy surgery, doctors often put thin needle electrodes deep into the brain (stereo-EEG, or SEEG) and wait for a seizure. They then have to work out which of a hundred or more recording sites belong to the epileptogenic zone, the patch of brain that starts the seizures and has to be removed. This paper models each channel as a hidden Markov chain moving between a few brain "states". It flags the channels whose pattern of switching between states changes most at seizure onset. Below, the whole method (constrained Baum–Welch, both KL scores and the single-state benchmark) runs live on simulated SEEG recordings.
Why it matters
For about a third of people with epilepsy, medicines don't stop the seizures, and surgery can cure them only if doctors remove the right patch of brain, which today they find mostly by reading hundreds of SEEG traces by eye. Across 30 patients, scoring how each channel's switching between hidden states changes at seizure onset picked out the surgeons' target channels with a mean AUROC of about 0.8, versus 0.53–0.65 for a comparable method that ignored the order of states.
The paper
Transition Dynamics Matter: Hidden Markov Scoring of Epileptogenic Channels in SEEG
Giulia Tacconi, Federico Mason, Lorenzo Ferri, Elena Pasini, Lidia Di Vito, Matteo Martinoni, Lara Alvisi, Anna Scarabello, Luca Zanuttini, Francesca Bisulli and Andrea Zanella (Department of Information Engineering, University of Padova; Institut de Neurosciences des Systèmes, Aix-Marseille University; IRCCS Institute of Neurological Sciences of Bologna; Department of Neuromotor and Biomedical Sciences, University of Bologna). arXiv:2611.26142 [eess.SP], submitted 19 November 2026; submitted to IEEE ICC 2027. Read on arXiv · PDF
In plain language: each SEEG channel is cut into 1-second windows (shifted by 0.25 s). Each window becomes a feature vector oi[w]: the energy, phase entropy and connectivity strength in seven frequency bands. The authors assume every channel moves through the same small set of hidden states, each producing features from its own Gaussian. What differs between channels is how often they jump from one state to another, captured by a transition matrix Ai. Baum–Welch is first run on all channels together to learn the shared Gaussians. It is then rerun on each channel alone, with the Gaussians held fixed, to learn a baseline matrix Aibase from the interictal period (between seizures). The same step on windows after onset gives the ictal (seizure) matrices Ai,wictal, using either a cumulative window (from onset up to w) or a sliding window (w − L … w + L).
A channel's change is measured in two ways. Transition KL (paper Eq. 8) compares the rows of the two matrices, weighted by how often the channel sat in each state at baseline (the stationary distribution πbase):
Occupancy KL (Eq. 9) compares only the long-run share of time spent in each state:
The higher Di, the more likely channel i is in the epileptogenic zone. The benchmark is the same model with a single state (Z = 1): each channel is just one Gaussian, so the order in which windows occur is ignored.
Try it: find the seizure-onset channels
The demo makes 16 simulated channels, each 200 s long: 170 s of baseline and then 30 s of seizure, in windows every 0.25 s (W = 797, onset at w* = 680, as in the paper). There are three hidden states, normal, busy and critical, and each window yields one feature (log high-frequency energy). That feature is Gaussian with means 0, 1.5 and 3 and the spread σ you set. At onset, the epileptogenic channels switch to a new transition matrix Aictal = (1−s)Abase + s[mAflicker + (1−m)Acrit]. Acrit makes them sit in the critical state. Aflicker = 1πbase has the same long-run state shares as baseline but no memory, so the channel flickers between states. "Spread" gives some healthy channels a weaker critical shift, like a seizure spreading to them. The demo then estimates everything blind with the paper's constrained Baum–Welch, holding the shared Gaussians fixed (we skip stage 1 and use the true ones).
What the paper found
- Data: 30 patients with drug-resistant epilepsy recorded at the IRCCS Institute of Neurological Sciences of Bologna. For each, one seizure was cut as a 200 s epoch (170 s before onset, 30 s after). The reference was the channels later treated by radiofrequency thermocoagulation, the clinicians' first surgical target.
- With energy features only, the hidden Markov variants reached a mean AUROC of about 0.79. The single-Gaussian benchmark scored 0.529, close to chance, and only reached 0.653 when all 21 features were used. The temporal model barely needed the extra features.
- With energy plus mutual information (F = 21), occupancy KL – cumulative did best (mean AUROC 0.797, AUPRC 0.437, best F1 0.511), closely followed by transition KL – sliding and occupancy KL – sliding. All three beat the benchmark (paired t-test, p < 0.01). Transition KL – cumulative did not clearly beat it.
- In an example patient, some epileptogenic channels already visited "critical" states before the seizure. Others joined at different times after onset, so channels leave their baseline at different moments.
Limits the authors note: the Gaussians assume features are independent within a state, even though features from the same band are correlated. Only one seizure per patient and the first 30 s of the seizure were used, so channels recruited later can be missed. Thermocoagulated channels are only a stand-in for the true epileptogenic zone.
How to use it
- Start with m = 1 (rhythm-only change). The epileptogenic channels spend the same share of time in each state as before, but stop "remembering" their state and flicker. The single-Gaussian benchmark sees the same mix of feature values, so it does no better than chance. It often does worse, because healthy channels, which keep their state longer, swing more within a short window. Transition KL still finds the channels, but occupancy KL can't, because it only looks at the state shares.
- Set m = 0 so the channels instead sit in the critical state. Now all three scores work, and occupancy KL is often the sharpest, as in the paper's best variant.
- Raise spread to recruit healthy channels into the seizure. Watch false alarms rise in the ranked bar chart.
- Raise σ until the three states overlap. The hidden states get harder to tell apart, and every method degrades.
- Switch between sliding and cumulative windows, and change L. A short sliding window reacts fast but is noisy. A cumulative window builds up evidence steadily.
- Click New random patient to redraw the recordings and check how much the result depends on luck.
Demo maths: 3-state HMM with 1-D Gaussian emissions shared by all channels and held fixed. Channel-specific transition matrices come from scaled forward–backward Baum–Welch (baseline: 20 iterations on windows 0…679; ictal: 6 iterations warm-started from Abase, with a 0.5 pseudo-count per transition so logs stay finite). Stationary distributions are found by power iteration. The benchmark is KL(𝒩ictal ‖ 𝒩base) between per-channel Gaussians fitted on the same windows (our reading of the Z = 1 case). AUROC uses the Mann–Whitney rank formula. All numbers in the stats come from the simulation, not the paper.