COunterfactual Reasoning for Temporal EXplanations: Plausible and Robust Explanations for EEG-Based Seizure Detection
Authors: Martina Zannotti
Bardh Prenkaj
Marco Piangerelli
Flavio Corradini
Gjergji Kasneci
Venue: Accepted by TMLR ()

Abstract: Identifying the drivers of change in time-sensitive domains like healthcare is critical for reliable decision-making, yet explanations must account for both temporal dynamics and structural complexity. While counterfactual explanations are well-studied for static data, existing methods often fail in dynamic, spatio-temporal settings, producing implausible or temporally inconsistent explanations. To address this, we introduce COunterfactual Reasoning for Temporal EXplanations (CORTEX), a search-based explainer for multivariate time series modeled as spatio-temporal graphs, tailored to binary seizure detection from EEG recordings. CORTEX generates temporally robust and plausible counterfactuals by retrieving relevant past instances and sieving them via structural dissimilarity, temporal distance, and robustness. As a result of its design choices, when evaluated on clinical seizure detection data, CORTEX outperforms state-of-the-art methods by 3.73x in validity and 6.32x in fidelity, and achieves zero implausibility, demonstrating consistency and practical relevance. By shifting the focus from mere validity to plausible, time-consistent explanations, CORTEX enables more reliable, controllable counterfactual explanations.

Published in Transactions on Machine Learning Research (03/2026)
COunterfactual Reasoning for Temporal EXplanations: Plausible and Robust Explanations for EEG-Based Seizure Detection
Martina Zannotti* Computer Science Division, University of Camerino, Italy
martioa..emnolii@uniiaaam. it
Syeew s.T.h., Italy
Bardh Prenkaj
bardh.prenkaf@tummcc de
Technical University of Munich, Germany
Marco Piangerelli
marro.yidnggrelli@eiiiinm it
Computer Science Division, University of Camerino, Italy Vici C. S.p.A., Itayy
Flavio Corradini
Raevio.cormadmm/@@niicca...m
Computer Science Division, Universily of Camerino, Italy
Gjergji Kasneci
djeraji.kasneriitamm..
Technical University of Munich, Germany
Reviewed on OpenReview: otperee/ue net/ forum? id- FkHVVmnNNS3
Abstract
Identifying the drivers of change in time-sensitive domains like healthcare is critical for reliable decision-making, yet explanations must account for both temporal dynamics and structural complexity. While counterfactual explanations are well-studied for static data, existing methods often fail in dynamic, spatio-temporal settings, producing implausible or temporally inconsistent explanations. To address this, we introduce COunterfactual Reasoning for Temporal EXplanations (CORTEX), a search-based explainer for multivariate time series modeled spatio-temporal graphs, tailored to binary seizure detection from EEG recordings. CORTEX generates temporally robust and plausible counterfactuals by retrieving relevant past instances and sieving them via structural dissimilarity, temporal distance, and robustness. As a result of its design choices, when evaluated on clinical seizure detection data, CORTEX outperforms state-of-the-art methods by 3.73x in validity and 6.32x in fidelity, and achieves zero implausibility, demonstrating consistency and practical relevance. By shifting the focus from mere validity to plausible, Lime-consistent explanations, CORTEX enables more reliable, controllable counterfactual explanations.
1 Introduction
Understanding the temporal evolution of model's prediction is critical for trust and accountability, es- pecially in sensitive domains like healthcare, where abrupt changes in a patient's physiological state e.g, those measured by Bledrreencephaloggaplyy (EEG) require timely intervention. Counterfactual explana- tions (Wachter et al. 2017) are promising approach to guide potential interventions for the end-user, they identify minimal and plausible changes to the input features that would lead the model to a different outcome. However, while common for static data, their application to multivariate time series is limited. Work done while the Technical University Munich.

---

Published in Transactions on Machine Learning Research (03/2026)
Class
J2 M
Time plays from ++1 to 7
Gallt
Class
When choosing counterfactuals dynamic contexts, consider temporal evolution alongside similarity. Given graph G; Gjj and G2 are two plausible counterfactual candidates. However, Gj,, as time goes by, has a "chaotic" trajectory; meanwhile, G has a more confined movement. We prefer G2 over time (i.e,, to be more stable, temporally robust). To simplify the presentation, have only depicted the change trajectories of G' and Gy2 over time.
Figure 1: Gist of CORTEX:
counterfactual for G; since is likely to remain in the counterfactual class
Existing methods fall short by focusing on feature modifications without preserving underlying implicit corre- lations (Ates et al. 2021) by restricting modifications to predefined deviation intervals (Yamaguchi al. 2024). These approaches neither reflect the apatio-temporal structure nor focus on the structural differences that drive changes in model outcomes, making them fundamentally inadequate for dynamic, autoregressive contexts where modifications to past observations propagale and influence future Irajectories.
To effectively illustrate the distinction between static and spatio-temporal counterfactual explanations in our scenario, we provide Example (best viewed in color):
Example 1: Static vs. seatio-temporal counterfactual
Static counterfactual:
"If the avg. slow-wave activity was 20% lower and the signal variability was 10% lower across the EFG measurement, then the patient wouldn't have had epileptic seizure."
tempooltemporal counterfactual:
"If, in the last 5 seconds of EEG activity the avg. power the low-frequency activity sloow-waves) the right temporal lobe was 15% lower and the signal variability ( (variance) in the frontal lobe was 5% higher, then the patient. wouldn't have had an epileptic seizure."
Legend:
feature time
space
This highlights the complexity of the spatio-tempp tempoal counterfactual: i.e., it must not only address three dimensions of explainability (feature, time, and space) but also explicitly process data inherently structured by these dimensions and account. for temporal dependencies from past to future.
In this paper, we address the challenge of producing robust temporal graph counterfactual explanations for multivariate time series, tailored to binary epileptic seizure detection from EEG data. We aim to identify the changes required to transition from an anomalous to normal state, terminating the epileptic episode and restoring normal brain activity, which is a clinically relevant objective!! I1 For this purpose, we propose a novel search-based explainer, COunterfactual Reasoning for Temporal EX planntationss (CORTEX). To account for the relationships among features, time, and space, represent time series spatio-temporal graphs and
These counterfactuals intended highlight structural differences patterns the data, and should be interpreted clinical recommendations.
2

---

Published in Transactions on Machine Learning Research (03/2026)
generate counterfactuals over them. Although our approach is not restricted to graph-based representations, modeling time series as spatio-temporal graphs allows us to explicitly encode interactions among features over time, which are difficult to capture with purely tabular- or sequence- based representations (Crradiiii ct al. 2026
Since the underlying dynamics of EEG readings are unknown, it may be unfeasible to generate plausible counterfactuals from scratch. Hence, CORTEX draws counterfactuals from previously observed robust states (sce Figure and then ranks them according to structural similarity, temporal distance, and temporal robustness.
This paper makes the following key contributions:
(1) A new paradigm for temporal counterfactuals. We introduce CORTEX, the first framework designed to generate counterfactual explanations that are not only valid but also plausible and temporally robust. Unlike prior methods that treat time series as static features or aggregate snapshots, CORTEX explicitly leverages the spatio-temporal nature of the data to ensure coherent, realistic explanations.
(2) Formalizing temporal robustness of temporal robustness - the requirement that a counterfactual remains in the target class over time via phase trajectory analysis of model predictions. This extends the standard desiderata of counterfactual explanations (Guidotti 2022 to dynamic settings, providing a new principle for designing explainers in autoregressive domains.
desideratum. We define and operationalize the concept
(3) Demonstrated reliability in clinical time series. On EFEGbbased seizure detection, CORTEX con- sistently yields explanations that are both more faithful and more realistic than SoTA (6.32x higher fidelity, and zero implausibility), thanks to its design choices. By grounding explanations in temporally robust, his- torically observed states, CORTEX enables actionable and reliable recourse in high-stakes applications such as healthcare.
2 Preliminaries
Let g describe the (finite) universe of graphs. Let G (X E Raxd, A E RTX") E G be a graph with node leature matrix and (weighted) adjacency matrix A, where n the number of nodes, and the feature dimensionality. Let & G Y be (already-trained) classification model, where Y is the of target labels.
Note that the following assumes the reader understands that counterfactual explainability is post-hoc method applied to Φ i.e., after & has been Irained.
Definition 1 (Static graph counterfactual) Given + and G E G, counterfactual for G is found follows (Jiang et al. 2024- Prodo-Romero et ol. 20246):
arg min M(G,G"), G'Eg
(1)
(+G
where M G x G R20 an optimization metric, generally expressed in dissimilarity terms.
According to Guidotti 2022), counterfactuals should satisfy validity, minimality, proximity, plausibility, actionability, and causality. Note how Equation 1 satisfies the first three desiderata. While all these properties are important, the last three are seldom treated in other works. We argue that actionability and causality are more related to privacy literature i.e,, actionability ensures that changes only affect modifiable features, and causality requires preserving any known causal feature relationships, usually formalized through structural causal models and thus not treated in this paper. Contrarily, plausibility is the most overlooked desideratum because it enforces the counterfactuals to be in the distribution of the real data, phenomenon that learning-based. especially generative, explainers cannot always guarantee (see Ma et al. 2022
Prado-
Romero et al. 2024a).
Taking inspiration from Guidotti (022) and the definition of counterfactual robustness (Jiang al. 2024 introduce additional desideratum, namely temporal robustness, which is essential to ensure nobust
3

---

Published in Transactions on Machine Learning Research (03/2026)
of counterfactual explanations in dynamic settings. Temporal robustness requires that counterfactuals remain consistently classified by ① over time, i.e., they do not lie in non-robust transition regions of the feature space. In other words, temporal robustness is needed to guarantee that the generated counterfactual does not immodiately revert to an anomalous state as the time series evolves. Without this property, the counterfactual would lose practical relevance, since its validity would not persist under the natural temporal dynamics of the system.
Before extend the notion of counterfactuals for spatio-temporal graphs, let us define what time (finite) x where ny, is the number of nodes at time graph is: i.., graph G2, (Xt, "g",,xd,,, E _*,,)"))) 4 E N. Now the graph universe G contains all possible time graphs.
Definition 2 (Temporally robust graph counterfactual) Given Gt. EG, D, and an optimization met- ric M 9 x 9 - Rz0 (e.g., dissimilarily, temporal distance), counterfactual for Gt, salisfies validily, minimality, prozimity, and temporal robustness if
min M(Gr, Gt,) s.t. So(Gr,) Sc, Gr (())< ((
(2)
where ()) denotes the set of graphs prior to time t, Sx : 9 - [0, is an instability score of t on a graph (intended as a lack of temporal robustness), and e is an upper bound on instability. Smaller values of S& indicate more lemporally robust predictions.
In words, Definition 2 selects among past candidates that flip 4's decision, choosing the closest one that also exhibits sufficiently low predictive volatility. Plausibility can be guaranteed by construction we restrict the universe of time graphs to the observed dataset D, as is typical in cearch-based explainers (see Soction 3 Since the hard constraint in Equation
2 may occasionally yield no feasible solution, we also consider a relaxed formulation in which temporal instability is penalized rather than enforced:
arg min M(G,,, Gty) + So (Gt))
(3)
G1 (G) (G (CG)))
While the general task may involve multi-class classification, we focus here on the binary setting, aiming to explain how an anomalous state can be reverted to normality.
3 Related Work
Although our work focuses on counterfactual explanations for binary classification of multivariate EEG time series modeled as dynamic graphs, we also include methods for time series and static graphs for completeness.
Time Scries Counterfactual Explainers (TSCEs). Most counterfactual explanation methods are not designed for time series data. Recent approaches aim to fill this gap. For instance, Ates et al. (2021) generate counterfactuals by replacing entire features with those from distractor samples, optimizing for class change and minimal alteration, though this overlooks temporal dependencies. To address this, Delancy et al. (2021) propose an iterative, nearest-neighhoor-bese method that balances plausibility and spansity. Yamaguuhi et al. 2024) introduce "deviation intervals", restricting changes to decision-critical time regions for greater temporal focus and interpretability. Despite these advances, most time series methods treat inputs as flat vectors, ignoring their spatio-temporal structure or allowing non-actionable modifications to past inputs.
Graph Counterfactual Explainers (GCEs). Most existing counterfactual explainers focus on static graphs. These approaches (Abrate & Bonchi 2021 Bajaj et al.
2021
Cai et al. 2025 Lucic et al.) 2022
Ma et al. 2022
Nguyen et al. 2022 Numeroso & Bacciu 2021
Prado- Romero et al. 2024a Prenkaj et al.
2025 Sun el al. 2021 Tan et al. 2022 Wellawatte et al. 2022
Wu et al. 2021 | typically perturb the graph
minimally (add
remove edges and feature alteration). Search-based techniques (Liu et al. 2021) instead
explore the dataset to find optimal counterfactuals based on specific distance metrics (e.g., Graph Edit
NNte that it is meaningless to produce counterfactuals that succeed the original instance in time.
4

---

Published in Transactions on Machine Learning Research (03/2026)
annualy hormality
mommal
stable regooe
unstable regioe.
Electrotion (chotaneb)
Elecienbee (chouaee))
(a) EEG normal phases vs. abnormal ones.
(b) CORTEX identifies, for each anomalous data point at time 6, robust (i.e., stable) and normal counterfactual regions at time < L.
Figure 2: EEG has electrodes (channels) that record electrical impulses from specific brain regions over time. This can be represented as a multivariate time series. An epileptic event in EEG occurs when a population of cortical ncurons (in our case, across multiple channels) fires hypersynchronously, leading to sudden spikes, sharp waves, or rhythmic discharges. These can appear interictally (isolated spikes) or ictally (sustained, evolving patterns).
Distance). However, all these methods overlook time. For detailed review, see the Laxonomy in Prado- Romero et al. 2024b
Dynamic GCEs. Counterfactual explanations in temporal graphs remain underexplored, especially in do- mains where temporal plausibility critical, such as epileptic seizure detection. Dynamic graphs are classified into Discrete- Time Dynamic Graphs (DTDGs) and Continuous- Time Dynamic Graphs (CTDGs) (Kazemi et al. 2020 While CTDGs offer fine-grained resolution, their irregular event streams make counterfactual generation particularly challenging. CoDy (Qu et al. 2025 usees search-based approach with Monte Carlo Tree Search and temporally aware heuristics, but assumes access to continuous event streams, making it unsuitable for DTDGss In DTDGs, most explainers rely on windowed snapshots. These include explainers based on surrogate models (He et al. 2022), temporal decomposition (Liu et al.) 2024), and feature attribu- tion Fan et al., 2021), but often fail to ensure semantic similarity and plausibility. Generative models like GRACIE (Prenkaj et al. 2024) improve this by modeling class-cov cass-conditional distributions over snapshots, but still operate coarse granularity. Generating fine-grained, plausible counterfactuals at the level of individual time steps, without relying smoothed aggregated views, remains open challenge, which address in this paper.
3.1 Challenges and Gaps in SoTA
TSCEs. Most TSCEs perturb raw input features or limit changes to learned deviation intervals, often ignoring inter-featen fetturfeature dependencies (Ates et al. 2021 Delaney et al. 2021 Yamaguchi et al., 2024). They also allow direct modifications to past data points, an unrealistic assumption in domains where past states are immutable. Instead, we select temporally robust, structurally coherent past instances as counterfactuals, ensuring both plausibility and validity.
Static GCEs. While the explainers in this category capture relational dependencies, they lack temporal awareness and therefore offer limited utility in dynamic settings. We overcome this by treating the system sequence of graph snapshots and generating timestamp-level counterfactuals that capture both spatial and temporal structure.
Dynamic GCEs. Dynamic GCEs better reflect evolving systems but often target CTDGs or use windowed aggregation DTDGs, yiclding global temporal (Qu et al.] 2025) or coarso-grained explanations (Prenkaj et al. 2024). Such approaches are ill-suited settings that require fine temporal resolution. Our method instead operates at per-timestamp granularity (ie.,, DTDG with window length of 1), identifying robust,

---

Published in Transactions on Machine Learning Research (03/2026)
real past observations comnteraattulls and enabling localized, plausible explanations without temporal smoothing.
4
Context
Let us contextualize the scenario we are dealing with to ensure the reader understands what normality and anomaly in EEG multivariate time series mean, and why robust counterfactuals are preferred over mere valid ones. EEG signals are collected from multiple electrodes across different brain regions to measure electrical activity. Each channel records the potential difference between a pair of electrodes, and the values collected over time constitute the features of the multivariate time series. We consider a binary classification problem: normal (no epilepsy) versus a abnornal (epilepsy) condition (see Figure 2a Our focus is on providing recourse for anomalous phases that is, identifying the changes required to terminate hypersynchronous neuronal firing rather than on the transitions from normal to abnormal states. This is motivated by neuroscience and clinical evidence showing that seizures often ceff-terminate through specific network- and cellular-scale mechanisms, and that interventions aimed at terminating seizures (e.g., closed-loop stimulation) are a major clinical objective (Kramer et al.) 2012; Jiruska et al. 2013 Khambhati et al. 2015 Merelli et al. 2016 Connolly et al.) 2024). Counterfactual recourse prescribing how to exit the anomalous state is thercfore particularly relevant.
In our setting, this multivariate time series at each time t; gets transformed into time graph G where nodes represent channels and the adjacency matrix encodes cross-corrclations between channels over a sliding
window, following prior work on GNNs for EEG and time series data Tian & Zhang, 2025 Abadal et al.
2025 Corradini et al. 2026) (sce Section B for details). Rather than optimizing for Equation (1) at each ta
in the anomalous phase to simply find another graph Gr, such that ((G,,) j D(G,,), ) we aim to identify a
robust counterfactual that is likely to remain in the normal condition, as defined in Equation (3) Indeed, if we were to select G, immediately preceding an anomalous phase, we would obtaín valid counterfactual; however, this approach lacks robustness: advancing time from that state, the system typically returns to the anomalous regime, making Gt,, unsuitable in terms of robust ness and plausibility (Guidolti 2022). CORTEX, instead, distributes counterfactuals into "stable" and "unstable" regions, and restricts the search to those unlikely to return to the anomalous condition in the near future, which are considered temporally robust (see Figure 2b w.r.t. D's outcome.
5 Methodology
Here, we introduce our novel search- based explainer, COunterfactual Reasoning for Temporal EXplanations (CORTEX), that accounts for the relationship among feature, time, and space by modeling multivariate EEG series as spatio-temporal graphs. In our setting, each time step & of the time series mapped to a graph G1, whose nodes correspond to features (here, EEG channels) and edges encode their relationship (here, cross-correlation over a temporal window), following standard practices in the GNN literature for time scries data Corradini et al. 2026). On top of this representation, CORTEX produces counterfactuals see Section A for an algorithmic overview. Recall that we want to ensure the validity and plausibility of the counterfactuals, Therefore, instead of sampling from a learned latent distribution - see Ma et al. 2022) Prado-Romero al., [0244] Prenkaj et al.) 2025 (mong others we directly search for robust counterfactuals among past. observations in the dataset.
Robust Counterfactual Identification. Let G + [0, 1] be the function that assigns continuous score to each graph Gr, such that ((G,,) l[. 2 for threshold 0 E [0, 1]. For simplicity, we write o, = (G..).
A straightforward way to quantify the temporal robustness of the classification is to track the score a over time. In more detail, given a graph G we calculate (a,, u)), where o; the sigmoid value associated with (G,,), and i2 is the sigmoid oscillation velocity calculated over the next w time steps (ensuring it remains
3 Although abnormal events in EEG are rare, making classification potentially unbalanced, can mitigate this by sampling the channels during normal phases at different. frequencies (e.g., 256Hz instead of 512H2) and downsampling the series from the source, yielding a balanced dataset.
6

---

Published in Transactions on Machine Learning Research (03/2026)
Phase trajectory
Sigmoid values
3.5
Cazs
1.0
Dlass
3.0
Tansiton
Canddittss 0
20
2.0
0.6
15
20
1.0
0.2
0.5
0.0
0.2
0.4
0.6
0.8
1.0
100 200 300
400 500
Figure 3: (left) Sigmoid phase trajectory, colored by the oracle classification within the time window of length w (green if all points in the window belong to class 0; red if all belong to class 1; and yellow if the classification changes within the window, indicating transition regions). Darker green points indicate elements in G- (right) Sigmoid values over time, along with points in 9 (green points) and their residual permanence times r. Example from recording chb03_00 01.
within the series length T):
U. min(i++5+1.7) 0in((+45.7)
(4)
(min(i+ 4
where the denominator accounts for differences in sampling rates across the classes 8 correspond to greater amplitudes in the oscillations, which can lead to local instability of the predicted class of G., in the immediately succoeding time steps (i.c., lack of temporal robustness). Note that since we are performing a post-hoc analysis, the full time series is already available, and all values used to compute have already been observed. Therefore, this computation does not violate causality, and instability can be reliably measured from the observed signal evolution.
High values of ve
Given a graph Gr, s.t. (G.,,) = 1 (abnormal), we want find counterfactuals G2,, with low output-velocity combination. One map each (o,, u.) point into a output-velocity plot (see Figure (left)). Note that the ideal position for Gr, is at (), since the sigmoid value indicates that & classifies G2, as normal with a high score, and the velocity shows that Gr, has no risk of crossing 4's decision boundary in the near future (up to w time steps). Alas, in reality, it is unlikely that all counterfactuals Gt, are in (0, 0). Thus, we rank them according to their Euclidean distance 5, Va,² uy² from (0, 0). Given the set of valid counterfactual candidates G' for Ge::
g' (', 6,) (GL) + (GG) A 6,= Vo,2 + +
(5)
we sort all its elements in ascending order according to 6, and select the top 9% to form the subset G/:
OG) E Gy = (z) E A rank? (GGr, 9") - [q 19'11
(6)
where rank? (G,,, 55), G') is the 1-based rank of 6j in ascending order within g' (i.c., smallest 5 gets 1), and [9'l] gives the top 4% cutoff. The parameters and in Equations (4) and (6) are selected to achieve the desired level of temporal stability. Specifically, w controls how close candidate points can approach unstable conditions, while & determines the fraction of instances considered robust. Further details on parameter
selection and its impact are provided in Section B Similarly to Equation 2 {G')<, and (9),,, denote
the sets of valid and plausible counterfactuals for G that occur prior time L, in g' and 9r respectively. Tn
what follows, we abuse the notation, and use Gr, {g')<t, to indicate that G., belongs to (G')<,, instead
of (Gry 65) E (9")e,. for readability purposes. The same applies for 19
*IF (g') )ei, Le., either possible counterfactuals due (rare) poor training of 4, every counterfactual is in the future valid counterfactual cannot. produced. Tn such cases, the original instance returned.

---

Published in Transactions on Machine Learning Research (03/2026)
Multi-Objective Selection Criterion. Once obtain 83 C G, we search for the best counterfactuals by minimizing a metric function M : 9 G - Rgo- Given Gt,, CORTEX searches over all Gt E (G))<t, and optimizes M containing three components: (1) the dissimilarity between G2, and G1 (2) their temporal
distance, and (3) the robustness of Gt,-
(1) Dissimilarity Metric. We define M, as the Frobenius norm of the difference between the product of the Laplacians of Gr, and Gr and their node feature matrices:
Ma Gt,)) = |k, Xr, Le, Xt, lp
(7)
where Lt, E |l is the normalized Laplacian matrix of graph Gr, defined as Lt. Dr, A,, Dr, -1/2, with D. E N x the diagonal degree matrix of G1,, and I E R" the iden- tity matrix. The attentive reader would notice that Equation (7) is defined only when nn, = n,,, and is meaningful only if the nodes are considered in the same order. This condition holds in our scenario because each node consistently represents the same feature across the multivariate time series (sce also Section 6.2 Note also that Mo does not rely on & for its computation; this is because distances between oracle emn- beddings would reflect differences in class representations rather than single graph dissimilarities. Indeed, & tends to map instances of the same class close together in the embedding space, even if the graphs dif- fer significantly. As a result, oracle-basod distances would be biased towards class semantics and overlook structural graph differences.
(2) Temporal Distance. We also want to favor counterfactuals in (%)) <t, that are temporally close to the original instance. Thus, we define M3 the quadratic difference between it and ty:
Ma(Gr,, Gt,) (4 12)
(8)
We chose a quadratic form to heavily penalize graphs that are further apart in time. However, a study of other penalization functions (e.g., linear) is left for future work.
(9) Temporal Robustness. For cach Gi E Sy define the residual permanence time To as the number of consecutive time steps during which the sequence remains in Gg- Formally, let the permanence time Ty for Gt, E Gg be:
(9) Thus, Tj counts the length of the maximal contiguous block Gezar Geyuz.... that lies entirely in G- We then normalize Tj into an instability score M,, mapping the largest permanence to 0 (most robust) and the smallest permanence to (least robust), with intermediate values scaled linearly between 0 and 1. Formally, for all Ge, with (finite) permanence time Tj we define
T = max E N Gegen E Egy.
MG,
Tmax T
(10)
Tmax Tinin
where Tmax = =max(T;} and Tmin = min(r,} VG,, E 96 (by construction, Tmin = 0). If Tmax = 0, the set G/ only contains isolated robust counterfactual candidates. In this case, to avoid division by zero in Equa- tion (10,, we set (G,) 1. Note that M, is computed for all G1 and depends the hyperparamoters it associates every graph with an instability score over the lop-g"h most robust percentile of counterfactuals in Gy. We illustrate the permanence time with the shaded areas in Figure 3 (right).
the entire set 9 and on
and q. Note also how Equation (10) subsumes the role of Sp in Equation (3) since
CORTEX optimizes Equation 11 to find a counterfactual given a graph G1, where each torm is first normalized in (0, 1] across all candidates in {G/)< to balance their contributions to the overall metric:
arg min MG Gt,) ) + Mo(Gr, + M,,,,,) G2 (
(11)
M In Eq
So in Eq,
Note that one can also produce the top-k counterfactuals rather than the top-1 as described above.
Satisfied Counterfactuality Properties. CORTEX satisfies all desiderata in (Guidotti 2022) (besides actionability and causality, justified in Section Validity and plausibility hold since the search for
8

---

Published in Transactions on Machine Learning Research (03/2026)
counterfactuals is done over (Gg)<s, which, by construction, should contain valid and plausible ones see Equations 5 and c Proximity is enforced via Ma that accounts for both topology and node features. Finally, we guarantee temporal robustness by selecting robust candidates in (Gyhe,, (see Figure 3 (left)) and further reinforce it through My.
Notice that CORTEX operates on previously detected anomalies, analyzing their temporal evolution posteriori to highlight structural differences and support clinicians in guiding recovery towards normal EEG states. Although implemented offline in our experiments, the method can be adapted to streaming data: long anomalous segments are flagged by detector and past normal data is available, CORTEX can provide explanations and guide transitions towards the normal condition. The only required modification concerns the definition of tú in Equation U which currently relies on future time steps. In a streaming setting, V can be redefined using past time steps instead, or replaced by a proxy for temporal instability, potentially based on predictions of future behavior. All these aspects related streaming data will be investigated in future work.
6 Experiments
6.1 Datasets
PhysioNet CHB-MIT Scolp EEG (Shoeb. 2010 contains EEG recordings from 22 pediatric patients sampled at 256 Hz. PhysioNet Siena Scalp EEG (Detti 2020) has 14 adult patient EEG recordings sampled at 512 Hz. Since patients differ in their EEG characteristics, both the oracle training and the counterfactual generation are performed on per-patient basis to maximize the accuracy and generalizability of explanations. For this reason, we selected subset of patients with the highest number of recordings and seizures: patients chb01, chb03, and chb10 from the first dataset, and patients PNOO, PN06, and PN14 from the second. For each patient, we use all recordings with seizure events that share the same set of EEG channels to ensure data consistency, resulting in a total of 31 recordings to be studied (recording IDs can be found in Tables 1 and 2 each ID is in the form patientIl SentienII__rcorddnnne recordingID, where the string before the underscore indicates the patient and the number after indicates the recording). This selection provides richer intra-patient data and ensures that our model is evaluated on consistent, high-quality data, thereby improving the accuracy and goneralizability of patient-spocific explanations. Each recording contains time-varying graphs, where nodes correspond to EEG channels and edges encode their cross-correlations. The graphs reflect the spatial configuration of the electrodes and the temporal dynamics of their interactions. We point the reader to Section B for a detailed description of how to build these time graphs from the patient recordings.
6.2 Experimental Setup
Oracle training. For each patient, we train 2-layer GCN end-to-end on all their EEG recordings to predict the label of each graph G., at its time 4, We are aware that various GNN architectures, including spatio-temporal models (Corradini et al. 2026). ; can be used. However, we refrain from committing to a specific design, as CORTEX is a post-hoc explainer and a full architectural comparison of the oracle & is outside the scope of this work. Once trained, &b acts as a black-bor box oracle, providing predictions throughout the counterfactual generation pipeline.
Baselines. We compare CORTEX with two heuristic-based explainers i.e., OBS and DDBS (Abrate & Bonchi 2021 and a hybrid- based (search+ explainer GNN-MOExp (Liu et al. 2021). DDBS finds counterfactuals by filtering edges according to their probability of appearing in graphs of a given class. In our experiments, we adapt DDBS to compute these probabilities solely from past instances, thereby preventing the use of illegitimate future information in time series settings.
We noticed that learning-based explainers (e.g., Ma et al. 2022) are unsuitable our scenario because most recordings described above have single anomalous phase. Since learning- based explainers require mandatory training process, splitting the time series into train-test portions might yield splits that do not preserve temporal dependencies (i.e., training data in the future, test data in the past). In this way,
SSurce code: http:://githubb.cm//attttinn

---

Published in Transactions on Machine Learning Research (03/2026)
during training, these explainers would see the future beforehand, and they would not guarantee to produce
counterfactual that is in the past (see the conditions under arg min in Equations (2) and (3) Even a leave-one-subject-ort approach is not recommended in this context, given the high variability across patients. In such a sccnario, the explainer would primarily learn general patterns across patients and recordings. In practice, the resulting explanations would be less reliable and less informative, as they reflect population- level patterns rather than the patient-specific EEG characteristics that should underpin them. Hence, we exclude them from our analysis. We also exclude TSCEs from our comparison, as they generate explanations by modifying past instances, making their results not directly comparable with CORTEX. In future work, we plan to adapt all these explainers to time graphs. Recall that CORTEX belongs to the class of DTDG dynamic explainers, and the only work in the literature is GRACIE (Prenkaj et al. 2024). However, GRACIE requires creating two VGAE "experts" that represent the two EEG classes al time 40 Because, at lo, each recording has only one graph, GRACIE fails to learn these representations. Hence, it is a meaningless competitor our scenario.
6.3 Results and Analysis
CORTEX outperforms SoTA in terms of validity (3.73x higher) and fidelity (6.32x higher). Tables D and 2 report average validity and fidelity of CORTEX and SoTA methods across all 31 EEG recordings, based on the corresponding patient-specific oracle 4. CORTEX consistently achieves the highest scores, outperforming all SoTA models across the board. This performance is the result of a key design choice: counterfactuals generated by searching only among valid and lemporally robust past instances. Errors occur only when explaining instances misclassified by the oracle (i.e., when explaining false negatives) for which CORTEX has valid candidate in {Gg)<t Contrarily, SoTA models primarily focus perturbing the original instance while minimizing dissimilarity, but this often comes at the cost of validity.
Table 1: CORTEX vs. SoTA in terms of validity (t). Best results in bold, second-best underlined. CORTEX
has 3.73x higher validity than the second-best performing method across the board.
choo1 _03
03501 21
41301 266
04303 001
ch303, .22
c0393, .08
ch503 09
cho03, 36
choo3 36
c1603 36
11200 CT
ah501_11
cho01
cho01
OBS
0.1032
0.3255
0.1724
0.1848
0.5325
0.2078
0.4122
0.3227
0.1629
0.2294
0,9008
0.3501
0. 0.2065
0,2100
0.4468
DDBS
0.0169
0.1695
0.0517
0.556-
0.1431
0.0506
0,1888
0,1
0.0151
0.1322
0,1305
0.1229
0.0168
0.0787
0.1835
GNX MOExp
0.0617
0.1745
0.0690
0,1433
0,1341
0.0532
0.0798
0.1493
0.0902
0.1596
0.2105
0.2577
0.10
0.1391
0.0718
CORTEX
1,0000
1,0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1,0000
1.0000
1,0000
1,0000
ca810
dlb10
08610
18610-
F100.
PHDO
PHOD
2000.6
PHD6
PROG
FR06,6
PM14
PW14_2
OBS DIBS
0.1902
0.1028
B. 0.4083
0.3307
0,9599
0.5417
0.6566
0.2510
IL5257
0.0823
0.3764
0.7033
0.6311
0.1610
0.0471
0.0779
0.9081
0.1951
0.4962
0.7996
0.1384
GNN MOExp
0.0957
0.0852
0.1163
0.1071
0.2021
0.9485
0.9028
0,8819
0.1128
0.4350
0.5281
0.500
0.3745
0.0015
0,2571
0.0886
CORTEX
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1,0000
1.0000
1.0000
1.0000
1.0000
1.0000
1,0000
1.0000
Table 2: CORTEX vs. SoTA in terms of fidelity (t). Best results in bold, second- best underlined. CORTEX
has 6.32x higher fidelity than the second-best performing method across the board.
chho1 .3
càbo1 04
chb01_18
chb01 21
cab01 26
cab03,0 02
03003 03
c1603.6 04
cab03,2 34
22b03 25
11003 36
cab03
chho1
OBS
0.9439
0.1520
0.0718
0.1550
0.1101
0.0881
0.1731
0.1381
0.0747
0,0818
0,1296
0.1415
0.0861
0.0828
0.1933
DDBS
0.1799
00705
0.0315
0.1070
0.0835
0.0267
0/0879
0.0716
0.0237
0.0881
0.0585
0.0400
0.0229
0.0284
B0785
MOE-M
0.04%)
0.0051
0.0455
-0.0244
-0.1567
0.0300
0.0233
0.0801
0.0877
0.0964
0.1571
0.1947
0.0631
(.0960)
0.0000
CORTEX
0.9258
0.8910
0.4750
0.7263
0.6106
0.9259
0.8700
0.8953
0.9372
0.9159
0.9454
0.9147
0.9178
0.9261
0.8672
C2310 20
2b110 27
23010 90
22010 36
89
2800 1
19000
2900
1800
2996
2900
2990_
0634
20145
11
ORS
DDBS
0.0765
0,0314
0,0440
0.0188
63H00
08883
00500
12201
0.07000
91811
0.1380
0.7346
0.0008
000000
0.1000
010010
000000
000000
10000
108110
0.0000
00033
0.0143
0.0121
GNN-MOFXp
0.0615
0,0748
0
0.0590
00800
011510
0.3728
0.7843
0.7435
03330
81008
113808
0:3107
0.0833
CORTEX
0.9067
0.9057
0.7965
0.8740
0.5202
0.6088
0.0066
0.7912
0.5546
0.9008
0.1713
0.8753
10

---

Published in Transactions on Machine Learning Research (03/2026)
To provide concise overview, Table 3 presents the mean and standard deviation of validity and fidelity for each method across subjects. Statistical significance is assessed using paired two-sample t-test, comparing CORTEX with each baseline. CORTEX consistently achieves the highest validity and fidelity scores. All paired comparisons with CORTEX are statistically significant (p < 0.001), indicating that the performance differences are robust across subjects.
Table 3: Summary of evaluation metrics. For each model, the mean = standard deviation is reported for validity and fidelity, along with the paired t-test statistic comparing each method with CORTEX (p-values in parentheses).
Model
Validity
t-test (p-value)
Fidclity
f-test (p-value)
OBS
0.3594 + 0.2059
17.042
(< 0.001 ***)
0.1268 = 0.0766
19.386 (< 0.001 ***)
DDBS
0.2353 + 0.2132
19.642
<< 0.001 ***)
0.0774 + 0.0724
19.980
(< 0.001 ***
GNN-MOEXp
0.2745 + 0.2576
15.426
(< 0.001 ***)
0.1829 + 0.2185
10.771
(< 0.001 ***)
CORTEX
1.0000 + 0.0000
0.7852 + 0.1640
Including M3 and M, in Equation 11 has little effect on dissimilarity M.. Table 4 shows the impact of {g') vs. < as well as the temporal distance and robustness terms of Equation 11] on the top-5 counterfactuals on the recording chb03_01. 01. Note that for explainers performing searches over {9") Jete the term My is not defined.
Table 4: Study of variants of Equation 11 and the search space. We show mean and standard deviation of Mas / MM, and M, computed over the top-5 counterfactuals for the recording chb03_ 01 (oracle accuracy: 0.9336). The components of all optimization variants are normalized in [0, 1] as described in Equation [11 All values are computed only on the explanations for the correctly classified instances (i.e., true positives) Last row is CORTEX.
Variant
Search space
Ma (4)
V Mg (4)
My (4)
M = Ma + +Mg
(g]k
0.439 = 0.004
61.787 = 16.309
0.714 + 0.203
M = Ma + MMg
(9)
0.419 = 0.011
39.282 = 10.132
M Ma
19
0.433 + 0.003
189.886 + 86.495
0.782 + 0.187
M- Ma
(9')
0.430 + 0.004
182.502 +: 88.909
M- Ma + My
(9))a
0.451
0.008
179.553 + 91.993
0.150 + 0.062
M MM. M3 + M,
19
0.451 0.006
66.560 + 3.980
0.230 + 0.065
The values of Ma remain consistent across the board. M3 makes CORTEX choose counterfactuals closer in time to the original graph, with a small standard deviation (see MMg) indicating that the counterfactuals are more similar each other w.r.t. the underlying dynamic conditions. Notice that M3 and M, are specular optimization metrics (see rows and 6). My prefers counterfactuals that stay longer in "stable" regions i.e., the left-most data point in stable region is preferred, but it is also further away from the original instance than the right-most one as shown in Figure 3 (right). M3 penalizes this temporal distance. However, when both are included (last row), there is a staggering trade-off where Mg improves by 62.93% whereas M,, is just increased by 0.08 points. Notice also that when both these metrics are included, the standard deviation of Ma is the lowest among all variants. Finally, optimizing for My, also yields the largest gain (compare rows 1 and with and 6). As expected from Equation (3) and Section 5 the robustness counterfactuals clearly ameliorates their quality (-67.8% in M,) only small increased temporal distance (+7.72% in MMa) and increased dissimilarity (3% in Ma) compare row with last.
11

---

Published in Transactions on Machine Learning Research (03/2026)
6.4 Discussion: Plausibility vs. Dissimilarity
By design, CORTEX achieves zero implausibility by restricting the counterfactual search to robust instances within the datasct, effectively producing counterfactuals that have already been observed. Contrarily, OBS and DDBS generate explanations by modifying the original graph. As consequence, the counterfactuals remain close to the original instance (low dissimilarity) rather than truly reflecting the characteristics of graphs that & would classify as normal (resulting in high implausibility). GNN-MOExp does not enforce the same nodes between the original and counterfactual graphs, resulting in an undefined implausibility score (see Equation 15
Notably, when implausibility is high, dissimilarity becomes irrelevant, since such counterfactuals are inher- ently unsuitable regardless of their proximity to the original graph. In other words, argue that plausibility is a necessary condition: only counterfuctuals with low implausibillly should be considered, and only then, dissimilarity becomes a meaningful criterion for further selection. Even if OBS and DDBS show lower dissim- ilarity scores due to generating counterfactuals with identical node features and binary adjacency matrices, this alone does not guarantee explanation quality if plausibility is not satisfied. See Section D for details on the implasiiblityyddiimmfirtt relationship among the explainers.
7 Generalizability
Although the currnt study focuses on seizure detection, the methodology is inherently lomain-agnostie and has strong potential for application to other physiological signals, as well as to time sories in domains such as financial data or industrial sensor monitoring. For instance, in an industrial monitoring scenario, multiple interconnected measurements could be represented as a -patoo-temporal graph, and temporally robust counterfactuals could highlight minimal changes that characterize anomalous conditions, supporting predictive maintenance and failure prevention.
To use CORTEX effectively, we recommend datasets with the following characteristics. First, the series should be homogeneous and naturally suited to a graph representation, which makes the generated coun- terfactual graphs easier to interpret. In this regard, the literature on spatio-temporal GNNs for time series data provides useful guidance. Second, the number of features (i.e., nodes) should remain manageable to keep explanations interpretable. We recommend an ideal range of 15-30 features to ensure the resulting counterfactual graph remains readable. Finally, datasets containing sequential anomalies are preferred, these are the primary focus of our analysis.
Once a dataset has been identified, the key adaptation is to calibrate paramcters for identifying stable candidates in Equations 4 and ( to domain-specifie needs, as shown in Section B While this calibration is currently manual and tailored to the EEG-based seizure detection problem considered in this study, developing more general automated strategics for parameter selection will be the focus of future work and an important step lowards realizing the full cross-domnin potential of CORTEX beyond this specific setting,
More generally, the CORTEX methodology, and in particular the principle of temporal robustness, can be applied beyond graph- representations once an alternative dissimilarity metric and method to capture dnter-dependencies are defined. In this case, the resulting counterfactual would no longer take the form of a graph, but it would preserve the desired properties of plausibility and temporal robustness. We consider CORTEX a first approach for generating plausible, temporally robust counterfactuals, with the potential for broad applicability across datasets and domains.
8 Conclusion
We introduced CORTEX, a novel search-based explainer that finds reliable, robust counterfactuals for mul- tivariate EEG series represented as spatio-temporal graphs. By moving beyond the conventional focus on minimizing feature perturbations, CORTEX explicitly addresses the critical needs of dynamic, high-stakes domains by proposing temporal robustness i.e., ensuring the suggested recourse remains valid over subse- quent time steps- as new desideratum for counterfactuals. Evaluated on E.E--based seizure detection,
12

---

Published in Transactions on Machine Learning Research (03/2026)
CORTEX significantly outperformed the existing SoTA, achieving 3.73x higher validity and 6.32x higher fidelity, while crucially maintaining zero implausibility.
Building upon these foundations, future work directions include exploring alternative penalization functions for the temporal distance metric to better calibrate the importance of time, and generalizing the method to handle a wider variety of dynamic graph structures. Extending the approach multi-class classification is another important direction; in this case, is necessary to determine whether counterfactual explanations aim transition from given class to any other class of temporal dynamics and stability along the softmax phase trajectory accordingly. Extending CORTEX to streaming scenarios is also an interesting avenue: in this context, could be computed using only past time steps, or replaced with a proxy for temporal instability based on predictions of future behavior. Finally, integrating explicit notions of actionability and causality will also be essential to further enhance CORTEX's clinical utility and trustworthiness for expert practitioners.
specific target class, and to adapt the analysis
Author Contributions
Martina Zannotti:
Conceptualization, Methodology, Investigation, Software, Writing Original Draft, Writing Review & Editing. Bardh Prenkaj: Conceptualization, Methodology, Writing Original Draft, Writing Review & Editing, Supervision. Marco Piangerelli: Conceptualization, Methodology, Writing Original Draft, Writing Review & Editing, Supervision. Flavio Corradini: Project administration, Funding acquisition, Supervision. Gjergji Kasneci: Methodology, Writing - Review & Editing, Supervision.
Acknowledgments
This publication was produced while Martina. Zannotti was attending the Doctoral Research Program of National Interest in "Blockchain and Distributed Ledger Technology", with the support of scholarship co-fin co-financed by the European Union NGEU - NRRP, Mission 4, Component 2 (CUP J11J23001450006) with the contribution of the company Syeew s.r.l..
Bardh Prenkaj was partially supported by the Friedrich Schiedel Fellowship, hosted by the TUM School of Social Sciences and Technology and the TUM Think Tank at the Munich School of Politics and Public Policy.
This work has been partially funded by the European Union Next NexteenneaaiooEUU Mission 4, Component 2. under the Italian Ministry of Universily and Research (MUR) National Innovation Ecosystem grant ECS00000041- VITALITY CUPJ13C22000430001
References
Sergi Abadal, Pablo Galván, Alberto Mármol, Nadia Mammone, Cosimo leracitano, Michele Lo Giudice, Alessandro Salvini, and Francesco Carlo Morabito. Graph neural networks for electroencephalogram analysis: Alzheimer's 's disease and epilepsy use cases. Newral Networks, 181:106792, 2025. ISSN 0893-6080. URL http://wwwwcccceecccee.t..tto wtt.:ecettcccoccmceccccccccccc/t
doi: att.ccle/pp///09966002007//
Carlo Abrate and Francesco Bonchi. Counterfactual graphs for explainable classification of brain networks. Tn Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, KDD '21, pp. 2495 2504, New York, NY, USA, 2021. Association for Computing Machinery. ISBN 9781450383325. doi: 10.1145 10.1145/3444548... 444444448.346155. URL htttps://don 10g/10.0// 1145/3444548. 3467154
Emre Ates, Burak Aksar, Vitus J. Leung, and Ayse K. Coskun. Counterfactual explanations for multivariate time series. In 2021 International Conference on Applied Artificial Intelligence (ICAPAI), pp. 1-8, 2021. doi: 10. T0.1109/CCAPAT4975.5.. 200.9900000.....
Mohit Bajaj, Lingyang Chu, Zi Yu Xue, Jian Pei, Lanjun Wang, Peter Cho-Ho Lam, and Yong Zhang. Robust counterfactual explanations on graph neural networks. Advances in Neural Information Processing Systems, 34:5644-56 5655, 2021.
13

---

Published in Transactions on Machine Learning Research (03/2026)
Ruichu Cai, Yuxuan Zhu, Xuexin Chen, Yuan Fang, Min Wu, Jie Qiao, and Zhifeng Hao. On the probability of necessity and sulficiency of explaining graph neural networks: A lower bound optimization approach. Newral Networks, 184:107065, 2025.
Mark J. Connolly, Sujin Jiang, Lim C. Samuel, Claire-Anne Gutekunst, Robert E. Gross, and Annaelle Devergnas. Seizure onset and offset pattern determine the entrainment of the cortex and substantia nigra the nonhuman primate model of focal temporal lobe seizures. Plos one, 1988)=0030796, 2024.
Flavio Corradini, Flavio Gerosa, Marco Gori, Carlo Lucheroni, Marco Piangerelli, and Martina Zannotti. A
systematic literature review of spatio-temporal graph neural network models for time series forecasting and classification. Neural Networks, 195:108269, 2026. ISSN 1893-6080) doi: https:/ http:://///ooiooo11111111111 neunet. URL
Eoin Delancy, Derek Greene, and Mark T. Keane. Instance-based counterfactual explanations for time series classification. In Case-Based Reasoning Research and Development: 29th International Conference, ICCBR 2021, Salamanca, Spain, September 13-16, 2021, Proceedings, pp. 32-37,2447 Berlin, Heidelberg, 2021. Springer- Verlag. ISBN 978-3-030-86956 86956-4.
doi: 11110077977-3-000-0000 86957-166171111 3. URL https://dbi.orgg
10.1007/978-3-0000-B00
Paolo Detti. Siena scalp eeg database, 2020. URL
1.0.0/
Yucai Fan, Yuhang Yao, and Carlee Jon-Wong. Gen-se: Attention explainability for node classification in dynamic graphs. In 2021 IEEE International Conference Data Mining (ICDM), pp. 1060 1065. IEEE, 2021.
R. Guidotti. Counterfactual explanations and how to find them: literature review and benchmarking. Data Mining and Knowledge Discovery, pp. 1-55, 2022.
Wenchong Hc, Minh N Vu, Zhe Jiang, and My T Thai. An explainer for temporal graph neural networks. GLOBECOM 2022-2022 2022 IEEE Global Communications Conference, pp. 6384 6389. IEEE, 2022.
Junqi Jiang, Francesco Leofante, Antonio Rago, and Francesca Toni. Robust counterfactual explanations in machine learning: survey, In Proceedings of the Chirty-Third International Joint Conference on Artificial Intelligence, IJCAI '24, 2024. ISBN 978-1-956692-0411.. doi: /19663/jjaai.2024//3 URL
https://doi.. wrt..o.ggg.... 24963 2024/894
Premysl Jiruska, Marco De Curtis, John G. R. Jelferys, Catherine A. Schevon, Steven J. Schiff, and Kaspar Schindler. Synchronization and desynchronization in epilepsy: controversies and hypotheses. The Journal of physiology, (477777777777 2013.
Seyed Mehran Kazemi, Rishab Goel, Kshitij Jain, Ivan Kobyzev, Akshay Sethi, Peter Forsyth, and Pascal Poupart. Representation learning for dynamic graphs: A survey. Journal of Machine Learning Research, 21(70):1 73, 2020.
Ankit N. Khambhati, Kathryn A. Davis, Brian S. Oommen, Stephanie H. Chen, Timothy H. Lucas, Brian Litt, and Danielle S. Bassett. Dynamic network drivers of seizure generation, propagation and termination in human neocortical epilepsy. PLoS computational biology, 11 11()2) 10046608 2015.
Thomas N. Kipf and Max Welling. Semi-Supervised Classification with Graph Convolutional Networks. In Proceedings of the 5th International Conference on Learning Representations, ICLR '17, 2017. URL https: https:///penreet http:///nneeeeeeeeeeettoonaaaaaa mett/forrum?id=SJ44aayyy
Mark A. Kramer, Wilson Truccolo, Uri T. Eden, Kyle Q. Lepage, Leigh R. Hochberg, Emad N. Eskandar, Joseph R. Madson, Jong W. Loo, Atul Maheshwari, Eric Halgren, Catherine J. Chu, and Sydney S. Cash. Human seizures self-terminate across spatial scales via a critical transition. Proceedings of the National Academy of Sciences, 109(51):21116 1211122, 2012.
14

---

Published in Transactions on Machine Learning Research (03/2026)
Yazheng Liu, Xi Zhang, and Sihong Xic. A differential geometric view and explainability of gnn evolving graphs. Xivi preprint wrXi:2403.06/25, 2024.
Yifei Liu, Chao Chen, Yazheng Liu, Xi Zhang, and Sihong Xie. Multi-objective explanations of gnn predic- tions. In 2021 IEEE International Conference on Data Mining (ICDM), pp. 409-418. IEFE, 2021.
Ana Lucic, Maartje Ter Hoeve, Gabriele Tolomei, Maarten De Rijke, and Fabrizio Silvestri. Cl-gnnexplainer: Counterfactual explanations for graph neural networks. In Int. Conf. on Al and Statistics, pp. 4499 4511. PMLR, 2022.
Jing Ma, Ruocheng Guo, Saumitra Mishra, Aidong Zhang, and Jundong Li. CLEAR: Generative coun- terfactual explanations on graphs. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022. URL attps://oppnreevie.. net/ forum?id=-Y-sbbellva
Emanuela. Merelli, Marco Piangerelli, Matteo Rueco, and Daniele Toller. A topological approach for mul- tivariate time series characterization: the epileptic brain. In Proceedings of the 9th EAI International Conference on Bio-inspired Information and Communications Technologies (BICT). ACM, May 2016.
doi: 10.4108/cai.33 1--2-22211-11 2011.22622222.
Tri Minh Nguyen, Thomas P. Quinn, Thin Nguyen, and Truyen Tran. Explaining black box drug target prediction through model agnostic counterfactual samples. IEEE/ACM Transactions on Computational Biology and Bioinformatics, 2022.
Danilo Numeroso and Davide Bacciu. Meg: Generating molecular counterfactual explanations for deep graph networks. In 2021 International Joint Conference on Neural Nelworks (aatookss(JCMM)) (IJCNN), pp. 1-8. IEEE, 2021.
Mario Alfonso Trado-Romery and Giovanni Stilo. Gretel: Graph counterfactual explanation evaluation framework. In Proceedings of the 31st ACM International Conference on Information and Knowledge Management, CIKM '22 New York, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450392365. doi: 10.1145/351 3511888833556000
Mario Alfonso Prado-Romero, Bardh Prenkaj, and Giovanni Stilo. Robust stochastic graph generator for counterfactual explanations. In Proceedings of the Thirty-Eighhs AAAI Conference on Artificial Intel- ligence and Thirly-Sizth Conference Innovative Applications of Artificial Intelligence and Fourteenth Symposium Educatiinal Advances in Artificial Intelligence, AAA. AAAI24//AAII24/EAATT 2024a. ISBN 978-1-57735-887-99 doi: 10.1609 w3w...
AAAI Press, URL https://doi. org/10 1609/aasa
v38119 19. 30149
Mario Alfonso Prado-Romero, Bardh Prenkaj, Giovanni Stilo, and Fosca Giannotti. A survey on graph counterfactual explanations: Definitions, methods, evaluation, and research challenges. ACM Comput, Suru., 56(7), April 2024b. ISSN 0360-0300. doi: 10.1145/3618105. URL https://doi. fttts:://ai..rr/1o..11. org/10.1145/
3618105
Bardh Prenkaj, Mario Villaizán-Valleladdoo Tobias Leemann, and Gjergji Kasneci. Unifying evolution, expla- nation, and discernment: A generative approach for dynamic graph counterfactuals. In Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 2420-2431, 2024.
Bardh Prenkaj, Eistratios Zaradoukas, and Gjergji Kasnoci. Graph inverse style transfer for counterfactual explainability. In Forty-second International Conference on Machine Learning, 2025. URL https:// openreview.neteeeeeeeeee wtt.:/oorum..d-5277655...
Zhan Qu, Daniel Gomm, and Michael Färber. Cody: Counterfactual explainers for dynamic graphs. In Ferty-second International Conference on Machine Learning, 2025.
Ali Shoeb. Chb-mit scalp eeg database, 2010. URL https://physionns hwtpsiionntttoooeeeeooooo org/ http://ssiioo.oogooooootttt/ttee http////tteecmmiie.n chbmit/
Yi Sun, Abel Valente, Sijia Liu, and Dakuo Wang. Preserve, promote, or attack? gnn explanation via topology perturbation. ar Xio preprint or orXim:2133. 213.1444,,94, 2021.
15

---

Published in Transactions on Machine Learning Research (03/2026)
Juntao Tan, Shijie Geng, Zuohui Fu, Yingqiang Ge, Shuyuan Xu, Yunqi Li, and Yongfeng Zhang. Learning and evaluating graph neural network explanations based counterfactual and factual reasoning. In Proceedings of the ACM Web Conference 2022, WWW '22, pp. 1018 1027, New York, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450390965. URL https://do...rrge org 10 1145/3485444
3511948
Chongrui Tian and Fengbin Zhang. Eeg-based epilepsy detection with graph correlation analysis. Fronliers in Medicine, 12, March 2025. ISSN 2296-82228 858X. doi: 10.3389 L0.3389/fmeed 20ee URL http://dxx doi. org/ 0///10.338000 3389/f88mmmmm fmed. 2025. 1549491
Sandra Wachter, Brent Mittelstadt, and Chris Russell. Counterfactual explanations without opening the black box: Automated decisions and the gdpr. Harv. JL & Tech., 31:841, 2017.
Goemi P. Wellawatte, Aditi Scshadri, and Andrew D. White. Model agnostic generation of counterfactual explanations for molecules. Chemical science, 13(13):3697 3705, 2022.
Haoran Wu, Wei Chen, Shuang Xu, and Bo Xu. Counterfactual supporting facts extraction for explainable medical record based diagnosis with graph network. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguisties: Human Language Technologies, pp. 1942 1955, 2021.
Akihiro Yamaguchi, Ken Ueno, Ryusei Shingaki, and Hisashi Kashima. Learning counterfactual explanations with intervals for time-series classification. Proceedings of the 33rd ACM International Conference on Information and Knowledge Monagement, CTKM '24, pp. 4158 4162, New York, NY, USA, 2024. Association for Computing Machinery. ISBN 9798-00704469,, doi: 10. 10.1145/362767333679999 URL https:
7/doi 0t0oooo00//00.115/227777777 1ww.1111166666.3335 36799922
Hao Yuan, Haiyang Yu, Shurui Gui, and Shuiwang Ji. Explainability in graph neural networks: taxonomic survey. IEEE Transactions on Pallern Analysis and Machine Intelligence, 45:5782 5799, 2023. ISSN 19393539. doi: 10.1109/TPAMI 2P2.:/AP...222222222222222
16

---

Published in Transactions on Machine Learning Research (03/2026)
A
Algorithmic Overview
For clarity and completeness, we show the psoudo-code of CORTEX in Algorithm
Algorithm CORTEX
1: Input: G = (G Gi.....,Grr pre-trained oracle Φ g + Y; threshold 0 S 0
number of counterfactuals k
2: Output: top-k counterfactuals for each Gr, s.t. ((Gr,) =
Robust condidates identification
Get o, o s.t. 1[, 0] (G..) AG,, eg
for G1, 9 do
7: - 25 0min(++++1,27) min((++j.T
in Equation 4
8, + Vo,² min((i+::7) t
end for
10: Compute g' as in Equation
11: Compute G as in Equation 6
12:
13: Optimization to compute My only once VG2, E Ga
14: ++ Initialize empty list
15: for G2 E E9' do
16: Compute Tj as in Equation 99
17: [[]]+
18: end for
19: min, < (T). max, + max(T) max, -T
20: Y max, - min,
Now y is an array that has all taus normalized as Equation 110
21:
22: Multi- selection
23: of + dict() Empty dictionary that is going to contain the top-k counterfactuals for each Gt,
24: a + [1+00 |g]] |l Initialize a matria of dimensionality [g] |9 with elements equal to0
25: for G., E s.l. ((G,,) = do
26:
+ [[]]]
List of length H9tteal with all elements equal to to0
27: for Gt E (G do
28:
afi, + Ma(Gr,, Gt,) B[i.j] < Ma(Gr, Gtz) end for
29:
30:
31:
Normalize ali, :] and B[t
32: M + a[i, + B[t, +
33: sort(M, ascending)
34: cf[G.,] M[:k]
Take the first lt elements, and return list thereof
35: end for
36: return cf
We assume that all initializations are done in constant time and do not contribute to the overall time complexity.
The identification of robust candidates (lines 5-11) is performed has been trained. This step is executed only once, regardless of the number of anomalous instances to be explained. Let p= G), R ( Q 1 and the time complexity of querying & for the outcome of graphs
preprocessing step after the oracle
6Th pipeline built. upon GRETEL framework available httpa://github.cr http://gthubb.coo//atttaaaaaa//a git
Prado- Rilto-Romera..oo & Stilo 2022
The source code for CORTEX is
17

---

Published in Transactions on Machine Learning Research (03/2026)
equal to (1) (i.e., line 5 costs O(1).. We also consider the worst-case scenario in which [( [g) R. (G)) | Q.
The identification of robust candidates costs ((wP) = O(P) since wo is constant. The computation of g' is (1) since we already have calculated U, and 6, for each G., in lines 6-9. The computation of G costs OR log R) since the rankţ function in Equation can be seen as sorting algorithm over G' in ascending order and then selecting the first q elements.
Before optimizing the multi-objective of Equation 11 we notice that, regardless of the input graph to be explained, the graphs in Jy can have their M, computed priori and only once (lines 14-20). To compute Tj we can scan reight and detect maximal contiguous runs of indices where G, E G/- For a run of length that starts at index s (i.e., indices 8, + I,... s + h - are in the set and s + is not or sequence ends), the permanence times are: Ts for run. Summed over runs this is ((Q) assuming that the membership G. & S3 is negligible. Hence, line 16 costs (QQ). Finding Tmin and Tmax costs O(Q), and computing Y (line 20) costs ((Q) since one can imagine this line to be an iteration over G again to compute the gammas. Therefore, lines 14-20 cost O(Q + Q + Q) = (QQ).
1, Ta+1 h 2...................... Ta+h-1 2e.hh..Tthh11 0. Filling these values costs O(h)
Let us now see how much computing Ma and Ma costs. Assuming that our graphs are memorized sparsely, computing their Laplacians costs (e)) where e is the number of edges. Then, the matrix multiplication between the Laplacian and the node feature vectors costs (naively) O(n²) where is the number of nodes. Hence the cost of Ma (line 28) is On +e) ((n)). M3 (line 29) is just simple difference between the time indices of two graphs and that can be done in (()). Now, lines 27-30 cost O(n²Q). Line 31 costs ((2) since it is just a simple min-mas max normalization and can be done similarly to lines 19-20. Line 32 is negligible. Line 33 costs (Q log Q) since the list M contains Q elements. Hence, the entire multi-objective selection procedure has a time complexity of O(P- (n²Q + +++Q++ Q log Q)) = ((nnPQ + PQ + PQ log Q) = O(n PQ log Q).
The total time complexity of CORTEX O(P + Rlog R + Q + n PQ + PQ l)
Since Q R P (and assuming Q 2 2) we have log Q 2 In this case, the lone P is dominated by PQ log Q, and the term Q is also dominated by PQ log because P Q. Thus:
O(P + Rlog R + Q + n PQ PQ log Q) = OoPQlog Q + n PQ + Rlog R).
Factor PQ from the first two terms:
O(PQlgg + +npp Rlog R) OPQQ 2 + log Q) + Rlog R)
If n >> log Q, then
O(PQ (n² + log Q) + Rlog R) = =O'' +Rogg R).
Otherwise, the safe compact form
O (n log Q) Rlog
Table 5 reports the average evaluation times of the explainers. The results indicate that CORTEX has relatively low computational times, even when compared to heuristic explainers, which are generally faster but often less accurate.
Table 5: Comparison of the average evaluation times.
Explainer
Avg. evaluation time
OBS
4.139
DDBS
9.439 8
GNN-MOEXp
0.119 $
CORTEX
0.939 8
18

---

Published in Transactions on Machine Learning Research (03/2026)
B Detailed Experimental Setup
CORTEX and SoTA were evaluated on standard laptop (i.e., Intel Core i7-13th Gen, 10-Core 16-Thread 16GB RAM) as experiments do not require high-ppeffrrmacc hardware.
Spatio-temporal graph construction. At each time step 4, we define a graph Gr, where each node u represents an EEG channel. We assign to cach node a feature vector containing its normalized value at time li, along with values from the previous m = 10 time sleps, each lagged by f 10. We compute edge weights as the absolute value of the cross-correlation between each pair of EEG channels over a sliding window of the past = 5 seconds. In our experiments, given the signal frequency and sampling rate, the sliding windows used to compute correlations overlap on average by approximately 15% during normal periods and by 90% during seizure events (values can vary depending on the specific time series). To prevent fully-connected graphs, we retain only the top kn = 4 edges per node and symmetrize the adjacency matrix. We select these hyperparameters through patient-specific grid searches and choose the final configuration to maximize oracle accuracy across patients. We encode cross-correlat ions as edge weights, following prior work on GNNs for EEG data (Tian & Zhang, 2025 AAbadal et al.) 2025) and to capture temporal variations in inter-channel dependencies. We assign a binary label to each graph based on whether its time window includes any seizure activity. To address class imbalance, we apply non non-uniform subsampling: we increase the sampling frequency during seizure periods and adjust it based on seizure duration. We exclude a total of 5% of each seizure window equally split between the beginning and the end to avoid unstable transitions that might blur class boundaries. This exclusion improves oracle accuracy while minimizing the amount of discarded data.
Oracle training. The design of the oracle does not have a direct influence on the overall pipeline. Its impact on the generated explanations is limited to its final outputs. Therefore, it is only important ensure its accuracy. Here, we use simple 2-layer Graph Convolutional Network (GCN) (Kipf & Welling, 2017), where node features of size d' are expanded to 4d' through the convolutional layers, and then mapped to the output via a fully-connected layer. A deeper investigation of the architecture would fall outside the scope of this work. Despite being trained on individual temporal snapshols, it is still possible to use our temporal approach for the explainer. To better capture individual variability and improve prediction accuracy, a separate oracle was independently trained for each patient using all EEG recordings for that subject, reserving 10% of the data as a test set for the oracle. The performance metrics across recordings for each patient are reported in Section C
Robust candidates identification. Once the oracle has been trained, we analyze the phase trajectory (a, v) of its sigmoid outputs. This requires setting the parameter which defines the length of the temporal window used in Equation { and the parameter q, which determines the fraction of instances considered robust when defining the set Gú in Equation (6). These values must be calibrated based on the specific application. To guide this selection, we recommend examining the phase trajectory and the corresponding set of robust candidates G. graphically, as illustrated in Figures 4 and 55] In general, higher values of q result in a larger number of points in Gy including points that may be less robust, which can cause the explainer to produce more variable results. In our experiments, we observed that varying w generally yields similar sets Gy. The main difference lies in the selection of points near the peaks of the sigmoid series: as w increases, the points in Gr tend to be located progressively further from the peaks (see Figure 5). Therefore, the choice of w should be guided by the level of robustness required for the specific case study. In our experiments, we set w= = 10. The set of robust candidates 9 is determined for each patient's FFG recording by selecting the q = 25% of points closest to (0, 0) in terms of Euclidean distance. Although we recommend choosing w and q based on the visual inspection of the phase trajectory in Figures 4 and 5 together with domain knowledge about the required level of temporal stability, it is also possible to examine this choice a posteriori through the fidelity values obtained after evaluation. The phase trajectory provides clearer insights into peak localization and series stability, whereas the fidelity analysis can be used as a complementary consistency check. Table t reports the fidelity values for the recording chb03_00 01 corresponding to the configurations shown in Figures and and additional combinations of the same parameters.
Multi-objective selection criterion. Given an anomalous instance G, from a specific EEG recording, we select the top k= = 5 counterfactuals by minimizing the objective in Equation (1]. which combines dissimi-
19

---

Published in Transactions on Machine Learning Research (03/2026)
larity, temporal distance, and counterfactual robustness. A visual representation of the top-5 counterfactuals is provided in Section
Phase trajectory
Sigmoid values
15%
17.5
3.0
dates
12.5
2.0
0.6
10.0
7.5
1.0
5.0
0.0
0.0
0.0
0.8
100
200
400
500
Phase trajectory
Sigmold values
Claas Class
25%
1.0
Tanshin
25
Card dibcs
0.8
2.5
Permanence time
2.0
0.6
15
10
0.2
0.0
400
Phase trajectory
Sigmoid values
3.5 Class
35%
1.0
Class
Trassiin
Cand datas
0.8
2.5
Permanencee Unne
1.5
0.4
20
0.2
0.5
0.0
0.2
0.4
0.6
0.8
1.0
100
200
300
400
500
Phase trajectory
Sigmold values
3.5
Class
43%
1.0
Trasshon
250
2.5
200
Permanenec time
0.6
150
1.5
0.4
100
1.0
0.5
0.0
0.0
0.2
0.4
0.6
0.8
1.0
100
200
300
400
500
Figure 4: Sigmoid phase trajectory and points in Gy as in Figure Example taken from recording chb03_01 01.
for 10 and different values of
20

---

Published in Transactions on Machine Learning Research (03/2026)
Phase trajectory
Sigmold values
Clsss
3.5
Clsss
Trassoon
-5
Cand detecin
0.8
3.0
Permanencc time
2.5
-15
2.0
-10
0.2
0.0
0.2
0.6
1.0
100
200
300
trajectory
Sigmaid
3.5
Clsss
Claas
Transtoon
w
1.0
25
Card detes
0,8
2.5
20
time
1.5
0.4
10
0.2
0.5
0.0
0.2
0.4
0.6
0.8
1.0
100
200
300
400
500
Phase trajectory
Sigmold values
3.0
Cless
1.0
2.5
20
Permanmenc time
0.6
1.5
0.4
1.0
0.0
0.0
0.0
0.2
0.6
0.8
1.0
100
200
300
400
500
Phase trajectory
Sigmaid values
3.0
20
Closs
dates
2.0
Permanencce time
0.6
1.0
0.0
0.0
0.2
0.6
1.0
100
300
400
Figure 5: Sigmoid phase trajectory and points in Gy as in Figure Example taken from recording chb03_01.
for q 25% and different values of w.
21

---

Published in Transactions on Machine Learning Research (03/2026)
Table 6: Fidelity values for different combinations of w and q. Example taken from recording chb03_01 01.
15%
25%
q 35%
45%
w
0.8484
0.8489
0.8677
0.8584
10
0.8486
0.8953
0.8679
0.8584
= 15
0.8494
0.8234
0.8677
0.8499
20
0.8595
0.8613
0.8677
0.8492
C Oracle Evaluation
To assess the performance of the oracle, accuracy, F1 score, recall, and precision. Let TP denote the number of true positives, TN the number of true negatives, FP the number of false positives, and FN the number of false negatives, where the positive class corresponds to the anomalous condition. The metrics are defined as follows:
four standard evaluation metrics for binary classifiers:
TP+TN
T. 2. + FP + PN TP
Accuracy TP + TN + FP+FN TP
Fl score
Precision = TP + FP FP
Recall T
All these metrics range between 0 and 1, with values closer to 1 indicating better performance.
Figure shows accuracy, F1 score, precision, and recall of the oracles for each patient across individual EEG
recordings.
chb01
chb03
chb10
PNOO
PN06
PN14
1.0
0.8
0.2
0.0
Acc.
F1
Rec.
Prec.
Acc.
F1
Rec.
Prec.
Acc.
Rec. Proc.
Acc.
Rec. Prec.
Acc. F1 Rec. Prec. Acc. F1
Rec. Prec.
chb01 03
cbb01 18
chb03
cha03
PN00
cha0) 04
etbo1
ctbo3_02 02
cha0s_3
cha10_20
chb10_3
PNO0
PNO0
PND6_
PNOS,
PN14_2
cho01 15
cib02, 26
cr803 03
cha03,36
dia10
cbb10
cha0)_18
Figure 6: Evaluation metrics of the oracles for each patient (panels) across individual EEG recordings (points).
D Explainer Evaluation
The quality of counterfactual explanations can be assessed using different metrics, each capturing different
aspect of the explainer's performance (Prado-Romero et al., 2024b Guidotti] 2022 Our evaluation criteria include validity, fidelity, dissimilarity, and implausibility, each calculated for every anomalous instance G E g and its corresponding ua G*, then averaged over the entire datasel.
Validity indicates if the explainer has produced a valid counterfactual, and is defined as
(Alidity(G,G") ([)(G) ((G')),
(12)
where 1[:] denotes the indicator function.
22

---

Published in Transactions on Machine Learning Research (03/2026)
Fidelity measures how much the explanations are faithful to the oracle, considering its validity. It is defined 88
Fidelity ace (C, (G, = [[ = y] - ( = y]
(13)
where y is the true label associated to G Yuan et al. 2023 A value of 1 indicates that both the explainer and the oracle are correct, while a value of 0 or -1 indicates an issue with either the explainer or the oracle.
By focusing on the predicted probabilities, a more sensitive measure of fidelity can be computed as
(14)
High values indicate better performance, as they reflect a substantial change in the prediction between G and G Low values, instead, indicate little or no change, which may suggest that the generated counterfactual is invalid adversarial. Unless otherwisc specified, when refer to fidelity, we mcan Fidclity prob defined in Equation [44.
Dissimilarity quantifies the closeness between an instance and its counterfactual. Here, Ma serves as the dissimilarity measure, as defined in Equation 7
Implausibility given by the minimum distance of the counterfactual G from the closest example in a reference population R:
Implausibility("") min D(G",)).
(15)
GER
Here, the distance ().:) is again represented by the dissimilarity measure Ma. In our setting, when evalu- ating the implausibility of a counterfactual Gř, for an anomalous instance Gt,, the reference population R is chosen to comprise all graphs in the datasct D observed before t; that were classified as 0 by the oracle. This ensures that the implausibility reflects how different the counterfactual is with respect to past instances of the target class. The use of the minimum distance, rather than an average, follows the formulation used by Guidotti (2022), where implausibility is interpreted as the deviation from the most similar instance in the reference population.
Ideal values for these metrics are validity and fidelity equal to 1, and implausibility and dissimilarity equal to O. By design, CORTEX always generates valid and plausible counterfactuals. Therefore, validity and fidelity only related to the oracle accuracy, while implausibility is always equal to zero. We include these metrics primarily for historical reasons and because they are considered standard in the literature.
In our results, we report validity and fidelity averaged only over correctly classified instances, and dissimilarity and implausibility averaged only over instances where Fidelity 1.
Table 7 reports the average implausibility and dissimilarity of the top-1 counterfactuals for each individual EEG recording, both computed only for explanations with Fidelity ace equal to 1, in order to avoid bias from incorrect counterfactuals. GNN-MOFxp is excluded from the table, its dissimilarity and implausibility are undefined.
Table 7: Average implausibility and dissimilarity of top-1 counterfactuals for individual EEGs. Best values in bold.
chb01_ __0 (oracle accuracy: 0.9621)
chb01_0d 04 (oracle accuracy: 0.9501)
chb01_ 15 (oracle accuracy: 0.6915)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
OBS
1.2003
0.4365
OBS
1.2775
0.3717
OBS
1.4889
0.4725
DDBS 0.9309
0.2715
DDBS
1.1972
0.2787
DDBS
1.2815
0.3156
CORTEX
1.7816
CORTEX
0
1.4246
CORTEX
0
1.6931
chb01_16 16 (oracle accuracy: 0.8760)
chb01_18 18 (oracle accurary: 0.7883)
chb01_21 21 (oracle accuracy: 0.9518)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
OBS
1.4973
0.4974
OBS
0.8399
0.1922
OBS
0.9665
0.5331
DDBS
1.4046
0.4083
DDBS
0.8054
0.1605
DDBS
0.8461
0.4181
CORTEX
0
1.6016
CORTEX
0
0.9082
CORTEX
0
1.1320
23

---

Published in Transactions on Machine Learning Research (03/2026)
chb01_20 26 (oracle accuracy: 0.9437)
chb03_01 (oracle accuracy: 0.9336)
chb03_ 02 (oracle accuracy: 0.9550)
Explainer
Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Exploiner
Implausibility Dissiuilarity
OBS
1.1791
0.3326
OBS
0.4121 0.3731
0.1101
OBS
0.6800 0.5273
0.2233
DDBS
1.0719
0.2404
DDBS
0.0773
DDBS
0.1025
CORTEX
1.2709
CORTEX
0.4476
CORTEX
0.8432
chb03_ 03 (oracle accuracy: 0.9554)
chb03_04 04 (oracle accuracy: 0.9708)
chb03 34 (oracle accuracy: 0.9052)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer Impleusibility Dissimilarity
OBS
0.8045
0.2170
OBS
0.0519
0.2992
OBS
0.9624
0.2567
DDBS
0.7965
0.1897
DDBS
1.0217
0.2422
DDBS
0.7707
0.1644
CORTEX
0
0.9130
CORTEX
0
1,1333
CORTEX
0
1.2208
chb03_35 35 (oracle accuracy: 0.9376)
chb03_36 36 (oracle accuracy: 0.9246)
chb10_ 12 (oracle accuracy: 0.9206)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explsiner Implausibility Dissimilarity
OBS
0.8425
0.2537
OBS
0.8376
0.2489
OBS
0.5573
0.1416
DDBS
0.6000
0.1428
DDBS
0.7162
0,1630
DDBS
0.5312
0.1027
CORTEX
1.1962
CORTEX
1.2513
CORTEX
0.6643
chb10 20 (oracle accuracy: 0.9462)
chb10 27 (oracle accuracy: 0.9641)
chb10 30 (oracle accuracy: 0.9501)
Explainer Implansibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
OBS
0.5905
0.1370
OBS
0.7422
0.1804
OBS
0.9513
0.2093
DDBS
0.4842
0.0808
DDBS
0.4877
0.0813
DDBS
0.8693
0.1410
CORTEX
0
0.8033
CORTEX
0
1.1736
CORTEX
0
1.1082
chb10_se 38 (oracle accuracy: 0.8943)
chb10_89 89 (oracle accurary: 0.8544)
PNOO_1 (oracle accuracy: 0.8876)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
OBS
1.0010
0.2314
OBS
0,9088
0.2243
OBS
1.3047
1.0654
DDBS
0.8795
0.1394
DDBS
0.8168
0.1633
DDBS
1.2586
1.0256
CORTEX
1.4308
CORTEX
1.1030
CORTEX
1.3237
PNO0 2 (oracle accuracy: 0.8508)
PNO0 4 (oracle accuracy: 0.8608)
PNOO_E 5 (oracle accuracy: 0.8983)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
OBS
0.9925
0.9394
OBS
1.0833
0.9085
OBS
0.3960
0.2386
DDBS
0.8648
0.7789
DDBS
1.0034
0.8186
DDBS
0.3816 16
0.2168
CORTEX
0
0.8519
CORTEX
0
1.1169
CORTEX
0
0.4756
PN06_2 (oracle accuracy: 0.7519)
PH06_3 (oracle accuracy: 0.6764)
PN06_4 (oracle accuracy: 0.8192)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer
Implausibility
Dissimilarity
OBS
0.0946
0.0453
OBS
0.0673
0.0438
OBS
0.1979
0.0915
DDBS
0.0910
0.0411
DDBS
0.0634
0.0367
DDBS
0.1917
0.0820
CORTEX
0.1386
CORTEX
0.2333
CORTEX
0
0.2736
PN06_6 _ (bracle accuracy: 0.7268)
PM14_1
(oracle accuracy: 0.8727)
PN14_3 2 (oracle accuracy: 0.8538)
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
Explainer Implausibility Dissimilarity
OBS
0.1925
0.0972
OBS
0.1463
0.0470
OBS
0.1368
0.1020
DDBS
0.1816
0.0924
DDBS
0.1385
0.0404
DDBS
0.1350
0.0971
CORTEX
0
0.4209
CORTEX
0
0.2330
CORTEX
0
0.1970
PN14_4 4_4 (oracle accuracy: 0.9248)
Explainer Implausibility Dissimilarity
OBS
0.6103
0.2448
DDBS
0.6850
0.2837
CORTEX
1.0545
OBS and DDBS consistently show lower dissimilarity scores, but these are often associated with higher implausibility, indicating that the generated counterfactuals are structurally less realistic. CORTEX, instead,
24

---

Published in Transactions on Machine Learning Research (03/2026)
achieves implausibility by design, as it searches counterfactuals within the dataset. We stress that implausibility is the primary factor in the evaluation: when implausibility is high, dissimilarity becomes uninformative, as proximity to the original graph cannot compensate for a lack of plausibility.
E
Visualization of Explanations
Here we provide graphical representations that offer both global and detailed view of the topological changes in the counterfactual explanations compared to the original instance. All the visualizations refer lo the same anomalous instance from recording chb03_00
Figure provides a summarized view of the top-5 counterfactuals for an anomalous instance by highlighting edges that consistently added removed across all of them. This summary helps identify structural changes that appear in most (or all) counterfactuals, which may correspond to meaningful topological changes rather than random variations. Figure&detaills the topology of each of the top-5 counterfactuals, highlighting added, removed, and preserved edges. Finally, Figure 9 offers more detailed comparison of edge weights between the original graph and its counterfactuals.
16
20
10
15
Figure 7: Visualization of edges consistently added (green) or removed (red) across the top-5 counterfactuals
for an anomalous instance. Example from recording chb03_05 _11
25

---

Published in Transactions on Machine Learning Research (03/2026)
(t 387.52)
G (t 321.97)
G1s 325.74)
329.52)
Figure Comparison between an anomalous instance and top-5 counterfactuals. Black edges are pre- served, red dashed edges are removed from the original graph, and green dashed edges are added in the coun- terfactual. Edge thickness is proportional to the corresponding weight. Example from recording chb03_00 01.
26

---

Published in Transactions on Machine Learning Research (03/2026)
Figure Edge weights of an anomalous instance and its top-5 counterfactuals. Fach cell corresponds an undirected odge between two nodes, with node labels shown along the axes. The dashed line shows the original weight, while vertical bars indicate the corresponding edge weights in the counterfactuals (green bars for added edges, red crosses for removed edges, and blue bars for modified edges). Example from recording chb03_01.
27


Reviews:
[{"review_id": "s5IZorY9JR", "reviewer": "Reviewer_ggeM", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "No", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "Summary:\nAuthors propose a temporally aware counterfactual explanation framework for EEG-based seizure detection. The method is post-hoc (given a trained classifier) and relies on constructing graphs from temporal windows of EEG signals. The key idea is to explicitly incorporate temporal robustness into the counterfactual search by identifying candidate counterfactuals based on the oscillation/uncertainty of classification outputs over time, and selecting counterfactual graphs among the most temporally stable ones. Experiments are conducted on two public EEG datasets comprising 36 patients in total. The proposed approach consistently outperforms baseline counterfactual methods.\n\nStrengths:\n- The paper is generally well written, with clear organization and a reasonably clear methodology. Reproducibility is acceptable (code availability would be a plus)\n- The motivation of counterfactual explanations for potential intervention is relevant and interesting (although this aspect is introduced relatively late in the manuscript)\n\nWeaknesses:\n- While the work is framed as counterfactual reasoning for temporal graphs, the proposed methodology is strongly tailored to EEG signals and seizure detection. It is a significant limitation that should be clearly acknowledged and motivated earlier (see major comments).\n- The framework is evaluated on a single application with two datasets (31 subjects independently assessed). Seizure detection can be addressed using other physiological signals and settings; it would be useful to discuss whether the proposed temporal robustness formulation could extend to other applications.\n- The experimental setting is unclear in several places: the paper mentions 36 subjects initially, but tables report results for 31; metrics are not always clearly defined; and it is challenging to assess comparisons with baselines fairly. The authors argue that learning-based baselines are not applicable because each patient is treated as a separate dataset, but it is unclear why a leave-one-subject-out (train on n-1, test on 1) setup would not be feasible (is inter-subject variability and domain gap in EEG too substantial?).\n- Two hyperparameters are set by “examining the data” (Appendix B), which is a strong limitation, especially since the authors state these parameters are application-specific. The method's sensitivity to these choices is not sufficiently analyzed.", "claims_and_evidence_yn": "No", "claims_explanation": "- While the proposed idea is interesting and the methodology is generally well motivated, the empirical evidence does not fully support the claims made in the paper.\n- Important methodological choices are insufficiently justified. \n- The experimental setup lacks clarity and consistency (dataset splits, subject counts, metric definitions), which makes it difficult to confidently interpret the reported improvements.", "audience_yn": "Yes", "audience_explanation": "- The paper introduces an interesting and timely direction by extending counterfactual explanations to temporal settings (likely to be of interest to the audience working on interpretability, time-series modeling, and graph-based learning)\n- The methodological idea of incorporating temporal robustness into counterfactual search is relevant beyond the specific application. But the current contribution is somewhat limited by its strong tailoring to a single application (EEG-based seizure detection). Demonstrating the framework's relevance to additional temporal or spatio-temporal domains would significantly broaden its appeal and impact.", "requested_changes": "Critical requested changes:\n- Clarity of the experimental setting \n- 1 more suitable application from tomporal series graphs (maybe at least another signal-based seizure detection, ECG?)\n\nTo strengthen the work:\n- Rewrite (mostly reorganize) context / motivation / related work\n- More discussion / limitations (sensitivity to the specific application, sensitivity to w and q parameters, sensitivity to sampling rate and other preprocessing steps of data)/ \n\n(see weaknesses and major comments for more details)", "broader_impact_concerns": "No concerns (current broader impact is helping to understand the mechanism and/or the design of intervention treatment for EEG-based seizure detection).", "additional_comments": "Major comments:\n- The motivation in the introduction is rather high-level and not fully convincing. To me, the crucial motivation is actually discussed in the first paragraph of Section 4 (Context) and it should be moved to the introduction.\n- In Definition 2 and the definition of a time graph, the time graph is defined only at a single time t_i, whereas Figure 1 suggests that a time graph corresponds to a set of graphs G_t_j over all t_j < t_i. Similarly, the instability score is defined as a function of a single time index. This inconsistency makes the notion of temporal robustness difficult to fully grasp.\n- In Equation (4), the computation of v_i uses future time points relative to i. While this is acceptable in a post-hoc setting, as authors state “Note that this computation does not violate causality, because all values used to compute vi have already been observed in the time series.” But it does violate temporal causality.\n- Since this is a post-hoc method, it would be useful to discuss whether a real-time variant could be designed, e.g., using only past information to compute v_i?\n- Clarify whether the temporal windows used around t_i overlap with previous windows. While values are provided in Appendix B, the effective temporal span depends on the sampling rate and should be explicitly discussed.\n- In Figure 3, red points appear to be more separated along the sigma_i axis, suggesting that sigma_i may correlate more strongly with the class than v_i. Given this, is Euclidean distance the most appropriate choice? A weighted or anisotropic distance (e.g., ellipsoidal) might be more suitable?\n- Although the details of parameters w (Equation 4) and q (Equation 6) are provided in Appendix B, a brief summary of how they were chosen should be included in the main text.\n- Section 6.2 is difficult to follow. The authors mention two datasets with 22 and 14 patients, then select three patients from each, then state that each patient is treated as a separate dataset, and finally report results on 31 recordings. This pipeline needs to be clarified.\n- If validity is defined as the counterfactual belonging to a different class than the original sample, and fidelity is reported separately, statements such as “2.73× improvement in validity and 5.32× in fidelity” are confusing. Percentage-point improvements would be more interpretable. Moreover, reporting validity values of 1.0 everywhere raises questions about the fairness of the comparison. Aggregated statistics across subjects would be more informative (along with statistical significance testing, or at least reporting the stds). \n\nMinor comments:\n- In the illustrative scenario in the introduction, the phrase “average slow-wave activity” implicitly assumes a temporal window. While I agree that the proposed method handles temporal information more explicitly, this example might be misleading. \n- In Figure 3: add a color legend directly in the figure, not only in the caption.", "extra_scores": {}, "extra_text": {}}, {"review_id": "Ov0d2iVoJK", "reviewer": "Reviewer_tnz1", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "This paper introduces CORTEX, a counterfactual explanation framework for EEG-based seizure detection that models multivariate time series as spatiotemporal graphs. CORTEX retrieves stable past graph states as counterfactuals and ranks them using confidence, temporal stability, and structural similarity criteria. Experiments on clinical EEG datasets show that the approach reliably produces valid and plausible counterfactual explanations and reports higher fidelity than existing baselines under the proposed evaluation.", "claims_and_evidence_yn": "Yes", "claims_explanation": "The claims of the paper are supported by the empirical results and a clearly described methodology. However, the abstract and introduction frame improvements in validity and zero implausibility as evidence of superior modeling over prior work, whereas these properties largely follow from the design choices of CORTEX. I would encourage the authors to reframe the experimental conclusions to better reflect this distinction.", "audience_yn": "Yes", "audience_explanation": "The paper would be of interest to readers in interpretability and time-series graph modeling, particularly those working on counterfactual explanations and applications in clinical EEG analysis.", "requested_changes": "The paper is generally well written and clearly structured. Despite not working directly in this area, I found the methodology and experimental setup easy to follow. To further improve clarity and strengthen the presentation, I have the following questions and requests for clarification:\n\n**C1.** The ranking in Eqs. 5,6 does not account for the asymmetry or scale differences between $\\sigma$ and $v$, where $\\sigma$ is a probability-like confidence score and $v$ is a normalized temporal velocity term. Could the authors clarify how sensitive the ranking is to this choice, and what would happen if one term were weighted more heavily than the other?\n\n**C2.** While the preliminaries introduce a general classification setting, the paper only explicitly states that the target task is a binary classification in Section 4. It would improve clarity to state this explicitly in the preliminaries so as not to confuse readers.\n\n**C3.** The motivation for using graph-based counterfactuals and spatiotemporal graph representations is not fully discussed. A brief justification of this choice, along with a discussion of alternative representations or counterfactual formulations and why they may be less suitable, would strengthen the motivation.\n\n**C4.** It is unclear whether the proposed counterfactual explanations are intended for online or real-time use. Since temporal robustness relies on multiple predictions over time, clarifying whether this framework is purely offline or whether it is meant to support real-time seizure detection scenarios would be helpful, particularly given the potential real-world implications of the latter.\n\n**C5.** Please refer to the explanation provided for “Are the claims made in the submission…” and consider updating the abstract and introduction to better align the framing of the experimental conclusions with the design choices of the proposed method.", "broader_impact_concerns": "No. I do not find any broader impact concerns arising from this work.", "additional_comments": "", "extra_scores": {}, "extra_text": {}}, {"review_id": "NtqyqwM2re", "reviewer": "Reviewer_G9kL", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "The paper proposed CORTEX, which is a framework for temporal counterfactual reasoning on the Electroencephalography data. The method searching for the relationship in the feature, time, and space on the  EEG spatio-temporal graphs. Compare with the previous feature only work, the method focus on the temporal robustness , that is the counterfacutal state will e stable on along the time axises.", "claims_and_evidence_yn": "Yes", "claims_explanation": "The paper provide solid mathematircal framework, implement the novel methodology and proved with emplirical results on the clinical dataset. \n\n1. The paper formally defines the key concept of temporal robustness, moving beyond traditional counterfactual methods that focus on static metrics. This claim is supported by the introduction of an instability score ($S_{\\Phi}$) and the use of phase trajectory analysis to identify transition regions in model predictions.\n\n2. Empirical Performance. CORTEX is benchmarked against state-of-the-art explainability methods on 31 EEG recordings from the CHB-MIT and Siena Scalp EEG datasets. The results are compelling: CORTEX achieves a 2.73× improvement in validity and a 5.32× improvement in fidelity compared to the second-best methods.\n\n\n3. Ablation Studies.\nThe authors provide a detailed ablation analysis of the multi-objective selection criterion (Equation 11). As shown in Table 3, incorporating both the temporal distance term ($M_{\\beta}$) and the robustness term ($M_{\\gamma}$) leads to significantly higher-quality explanations compared to using structural dissimilarity ($M_{\\alpha}$) alone.\n\n4. Interpretability for Clinical Use.\nBy modeling EEG signals as spatio-temporal graphs, the proposed framework enables visualizations that are directly meaningful for clinical practitioners. The figures clearly illustrate how specific electrode (node) activations and connectivity (edge) changes contribute to transitioning out of a seizure state.", "audience_yn": "Yes", "audience_explanation": "The findings of this paper would be of interest to the TMLR audience, particularly researchers working on Explainable AI, machine learning for healthcare, and graph neural networks. Most existing counterfactual explanation methods are designed for static data, whereas this paper introduces a framework for dynamic settings. The work makes a methodological contribution by formally defining temporal robustness. In addition, the proposed approach provides an effective way to capture temporal structural dependencies in EEG data.", "requested_changes": "1. **Generalizability Beyond EEG**.\nThe authors are encouraged to discuss the generalizability of the CORTEX framework to data types beyond EEG. While the current work is specifically tailored to seizure detection, the underlying principles—modeling multivariate time series as spatio-temporal graphs and searching for temporally robust counterfactuals—may naturally extend to other domains, such as financial time series or industrial sensor monitoring.\n\n2. **Computational Efficiency and Real-World Timing.**\nAlthough a complexity analysis is provided in Appendix A, the cubic dependency on the number of nodes ($n^3$) and linear dependency on dataset size ($P$) may pose challenges for high-density EEG configurations. The authors should report the actual runtime (in seconds or minutes) of the algorithm on the clinical datasets used and include a direct timing comparison with baseline methods (OBS, DDBS, and GNN-MOExp) to better assess real-world feasibility.\n\n3. **Ablation Study on Fidelity.**\nWhile the paper includes phase trajectory plots that qualitatively explain the selection trade-offs for parameters $w$ and $q$, a quantitative ablation study focusing specifically on Fidelity would strengthen the analysis. Similar to the performance comparisons in Table 2 or Figure 6, such a study would clarify how variations in these parameters affect explanatory accuracy.\n\n4. **Clinical Diagnostic Insights.**\nAlthough actionability is excluded from the formal problem definition, the authors argue that search-based methods produce more realistic counterfactuals. The paper would benefit from deeper clinical interpretation of the results, particularly how identified changes—such as specific edge additions or removals—relate to established neurological knowledge. For example, the authors could further elaborate on how the spatio-temporal counterfactual example on Page 2 (involving slow-wave activity in the right temporal lobe) corresponds to the patterns identified by the CORTEX algorithm.\n\n5. **Formatting Improvements.**\nTo improve clarity and ease of reference, a dedicated figure label or explicit textual reference should be added for the “Static vs. Spatio-temporal” counterfactual example presented on Page 2.", "broader_impact_concerns": "1. **Clinical Over-reliance.**\nThere is a potential risk that practitioners may interpret the generated counterfactual explanations as direct medical recommendations rather than as decision-support tools. Without careful framing, such explanations could be mistakenly treated as actionable treatment guidance, which may not align with established clinical protocols.\n\n2. **Actionability**\nAlthough the framework retrieves historically observed states, it does not explicitly incorporate actionability constraints. As a result, some suggested counterfactual states—while clinically plausible in retrospect—may not be readily achievable through available medical interventions, external stimulation, or treatment plans in real-world settings.", "additional_comments": "", "extra_scores": {}, "extra_text": {}}]

Author rebuttal:

Decision: Accept (poster)