IMFACT: Counterfactual Explanations for Time Series via Intrinsic Mode Function Substitution
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
IMFACT: Counterfactual Explanations for Time Series via Intrinsic Mode Function Substitution Udo Schlegel1,2 , Julian Rakuschek3 , Thomas Seidl1,2 , Andreas Holzinger4 , Tobias Schreck3 , and Javier Del Ser5,6 LMU Munich, Munich, Germany, udo.schlegel@lmu.de Munich Center for Machine Learning (MCML), Munich, Germany 3 TU Graz, Institute of Visual Computing, Graz, Austria 4 BOKU University Vienna, Vienna, Austria 5 TECNALIA, Basque Research & Technology Alliance (BRTA), Derio, Spain 6 University of the Basque Country (EHU), Leioa, Spain 1
arXiv:2608.04777v1 [cs.LG] 5 Aug 2026
2
Abstract. Oscillatory signals, such as vibration, carry class-discriminative information in specific frequency bands; perturbing them in raw feature space for counterfactual analysis easily destroys their temporal structure and produces physically implausible results. In this work, we introduce IMFACT (IMF-based counterfACTuals), a model-agnostic framework for generating plausible counterfactual explanations for time series classifiers that operates in the decomposition space of Empirical Mode Decomposition. An input signal is split into Intrinsic Mode Functions (IMFs), and selected IMFs are progressively substituted with those of a Nearest Unlike Neighbour (NUN) until the classifier flips to the target class. We evaluate six IMF-selection strategies and a multi-NUN cycling extension on two UCR benchmarks (FaultDetectionA, FruitFlies). The variance-based strategy with three NUNs outperforms two prominent baseline techniques on reliability and plausibility metrics, while cycling across three NUNs yields the best proximity across both datasets. Keywords: Explainable AI · Counterfactual Explanations · Time Series Classification · Empirical Mode Decomposition.
1
Introduction
Explainability is a prerequisite for the responsible deployment of machine learning in high-stakes settings such as predictive maintenance, medical diagnosis, and structural health monitoring [17]. Explanation methods are divided into ante-hoc approaches, which build interpretability directly into the model, and post-hoc approaches, which explain a trained black-box model after the fact [7,21]. Among post-hoc explanation methods, counterfactual explanations hold a privileged position: they are contrastive and directly answer “what minimal change to this input would have produced a different outcome?” [23], supporting actionable decision-making [1]. Oscillatory signals such as mechanical vibrations are particularly challenging in this regard, as their class-discriminative information is encoded in frequency bands rather than individual sample points [11].
2
U. Schlegel et al.
For tabular data, Wachter et al. [23] formulated counterfactual generation as a constrained optimization problem that minimizes the distance to the decision boundary. For time series, Native Guide [4] improved upon this by anchoring perturbations to a Nearest Unlike Neighbor (NUN), the closest training sample of a different class, providing an inductive bias towards in-distribution counterfactuals. Glacier [24] extended this by optimizing counterfactuals in a learned latent space regularized towards a NUN, improving plausibility over direct feature-space perturbation. Despite these advances, existing methods often operate directly in raw feature space, which can easily produce implausible waveforms that violate frequency constraints, alter structure, or yield out-of-range amplitudes [20]. In this paper, we propose IMFACT (IMF-based counterfACTuals), a modelagnostic framework that addresses the above limitations by operating in the decomposition space of Empirical Mode Decomposition (EMD) [8]. EMD decomposes a signal into Intrinsic Mode Functions (IMFs), amplitude- and frequencymodulated components without a predetermined basis. As a result, they have been extensively used for vibration-based fault detection because they carry physically interpretable frequency information [11,25]. Our proposed IMFACT framework introduces a different perspective on counterfactual generation for time series by shifting the perturbation space from raw signal values to an EMD decomposition into IMFs. IMFACT progressively substitutes selected IMFs with those of a NUN until the classifier flips to the target class. Building on this idea, IMFACT defines IMF-selection strategies that explicitly control the trade-off between proximity and plausibility by targeting the signal’s distinct frequency characteristics. By incorporating a multi-NUN extension, IMFACT enhances robustness and diversity in the search process by exploiting multiple target-class references. These design choices are validated on two datasets (FaultDetectionA and FruitFlies), considering six IMF-selection strategies and a multi-NUN cycling extension. Our results show that IMFACT achieves high validity while preserving temporal and amplitude properties, outperforming established baselines (Wachter [23], Native Guide [4], and Glacier [24]) in validity and proximity metrics. The remainder of this paper is structured as follows. section 2 reviews the background on counterfactual explanations, time series-specific approaches, and EMD. section 3 introduces the IMFACT framework and its main components. section 4 describes the experimental setup, including datasets, models, and evaluation metrics, while section 5 presents the results and comparative analysis. section 6 discusses the findings and, finally, section 7 concludes the paper and outlines future research directions stemming from the limitations of our work.
2
Background and Related Work
Before describing the proposed IMFACT framework, we review the foundations required by IMFACT, focusing on counterfactual explanations for time series (subsection 2.1), existing counterfactual generation approaches tailored to time series data (subsection 2.2), and finally, Empirical Mode Decomposition and its relevance as a perturbation space (subsection 2.3).
Counterfactual Explanations via Intrinsic Mode Function Substitution
2.1
3
Counterfactual Explanations
A counterfactual explanation x′ for an instance x with label y = f (x) is a minimally modified version x′ satisfying f (x′ ) = ytarget ̸= y [23]. Generation typically minimises: L(x′ ) = λ · d(x, x′ ) + ℓ(f (x′ ), ytarget ) ,
(1)
where d measures proximity and ℓ penalises target-class violation. Beyond validity (the counterfactual is classified as the target class) and proximity (the counterfactual is as close as possible to the original instance), the field converges on plausibility (the counterfactual lies on the data manifold and resembles realistic instances), sparsity (as few features as possible are changed to produce the class flip), and actionability (the required changes are feasible for the user) [6,22,1,20]. 2.2
Counterfactual Explanations for Time Series
Wachter et al. [23] provide a model-agnostic baseline via gradient optimization from a random initialization, but are not designed for temporal data and tend to produce diffuse, globally distributed changes. Native Guide [4] retrieves the NUN, extracts a class-discriminative weight vector from class activation maps, and guides perturbation between the query and the NUN, yielding temporally coherent, instance-grounded counterfactuals. Glacier [24] uses gradient search with local latent-space constraints; MASCOTS [16] operates in a symbolic feature space; Schlegel et al. [19] provide a human-in-the-loop method. Schlegel and Seidl [20] provide a survey and taxonomy of counterfactual explanation methods for time series, organizing existing work into optimization-based, evolutionary, instancebased, latent-space, segment-based, and hybrid approaches, and highlighting temporal coherence, plausibility, and actionability as the core open challenges. However, many of these methods, e.g., MASCOTS cannot handle long time series instances to generate counterfactual in a fast fashion. Despite this breadth of methods, none explicitly exploit signal decomposition as a perturbation space, a gap that IMFACT addresses by operating directly on the physically interpretable IMFs produced by EMD. 2.3
Empirical Mode Decomposition
EMD [8] decomposes a signal x(t) into IMFs c1 (t), . . . , cK (t) and residual r(t): x(t) =
K X
ck (t) + r(t).
(2)
k=1
The sifting algorithm iteratively identifies local extrema, interpolates upper and lower envelopes, subtracts their mean, and repeats until the IMF stopping criterion is met [13]. IMFs are ordered from highest to lowest instantaneous frequency, forming a data-adaptive, complete, near-orthogonal basis suited to non-stationary and non-linear signals [8].
4
3
U. Schlegel et al.
The IMFACT Framework
IMFACT generates counterfactual explanations by operating in the IMF decomposition space rather than directly in the raw time series domain. The core idea is to decompose both the query instance and a target-class reference into their constituent frequency modes, then iteratively substitute modes from the reference into the query until the classifier changes its prediction. Figure 1 provides an overview of the pipeline. We first formalise the problem, then describe the four algorithmic stages, the IMF-selection strategies, and the multi-NUN extension.
Fig. 1. Overview of the IMFACT framework. (1) NUN Retrieval: the Nearest Unlike Neighbor xNUN of the target class ytarget is retrieved for query x of class y. (2) Dual Decomposition: both signals are decomposed via EMD into IMFs IMF1 , . . . , IMFr plus a residual r, ordered from highest to lowest frequency. (3) IMF Substitution: IMFs are substituted from xNUN one at a time, in an order set by the chosen selection strategy (e.g. distance, variance, extremes), querying the classifier f after each step until the prediction flips to ytarget . (4) Return Counterfactual: the IMFs are summed to give the final counterfactual x′ , preserving unsubstituted structure while incorporating only the minimal components needed to cross the decision boundary.
3.1
Problem Formulation
Let x ∈ RT be a univariate time series of length T , classified by a black-box model f : RT → Y as class y = f (x). Given a target class ytarget ̸= y, IMFACT aims to find a counterfactual x′ ∈ RT that satisfies three criteria: validity (the counterfactual is classified as the target class, i.e., f (x′ ) = ytarget ); proximity (the counterfactual stays as close as possible to the original instance, typically measured by |x′ −x|2 ); and range validity (each time step of x′ remains within the value range observed for ytarget in the training data, ensuring basic plausibility).
Counterfactual Explanations via Intrinsic Mode Function Substitution
3.2
5
Algorithm Overview
IMFACT proceeds in four stages, illustrated in Figure 1. The key intuition is that instead of perturbing the raw time series directly, we operate on its frequency decomposition, replacing one IMF at a time with the corresponding mode from a target-class reference until the decision boundary is crossed. Stage 1 — NUN Retrieval. Given a query x with class y, we retrieve its Nearest Unlike Neighbor xNUN from the training set via nearest-neighbor search with Euclidean distance restricted to instances with label ytarget [4]. The NUN serves as a real, in-distribution representative of the target class and anchors the subsequent perturbation to the data manifold. For clarity, we describe the single-NUN case here; ?? extends this stage to a pool of n NUNs, from which IMFs are drawn according to a cycling or closest-neighbor policy. Stage 2 — Dual Decomposition. We apply EMD independently to both x NUN K ′ and xNUN , yielding IMF sets {ck }K }k=1 together with residuals r k=1 and {ck and rNUN , indexed from k = 1 (highest-frequency oscillation) to k = K (lowestfrequency oscillation), with r capturing the remaining non-oscillatory trend. If the two decompositions produce a different number of IMFs (K ̸= K ′ ), we zero-pad the shorter set so that every index k up to max(K, K ′ ) has a defined component in both signals, allowing IMFs to be compared and substituted position-byposition. Each IMF pair (ck , cNUN ) thus represents the same oscillatory scale in k the query and reference signal, respectively, and only the query’s residual r is retained throughout, since it encodes the coarse trend that is not the target of frequency-band substitution. Stage 3 — IMF Selection and Perturbation. We select an ordered sequence of IMF indices S = (k1 , k2 , . . .) according to the chosen strategy (subsection 3.3). At each step s, we replace cks with cNUN and iteratively reconstruct the candidate ks counterfactual as: X X x(s) = ck + cNUN + r, (3) k k∈S / s
k∈Ss
where Ss = {k1 , . . . , ks } is the set of already-substituted IMF indices, and r is the query’s own residual from Stage 2, kept fixed and never substituted with rNUN . We query the black-box classifier f (x(s) ) after each substitution and stop ∗ as soon as f (x(s ) ) = ytarget . This greedy one-at-a-time substitution of IMFs ensures that the minimum number of IMFs is modified before validity is achieved, naturally favoring sparse and proximal counterfactuals. In the worst case, the loop runs for |S| steps, so the total query budget scales linearly in the number of IMFs rather than with the length T of the raw series, which keeps the search efficient even for long signals. ∗
Stage 4 — Return. We return x′ = x(s ) as the final counterfactual explanation. If no valid counterfactual is found after all IMFs have been substituted, the method ∗ is considered unsuccessful for that instance; in this case x(s ) would coincide with xNUN itself (up to the retained residual r), and we report the instance as a failure rather than returning this fallback as an explanation.
6
3.3
U. Schlegel et al.
IMF-Selection Strategies
IMFACT relies on an ordering or weighting over IMFs that determines which modes are substituted first. Different strategies encode different hypotheses about where the class-discriminative information resides. We consider six strategies: – distance: For each IMF, we compute the Jensen–Shannon divergence between the power spectral density (PSD) of the current IMF and the PSD of the corresponding NUN IMF; IMFs with larger divergence are perturbed earlier. This favours modes whose frequency differs most between query and NUN. – variance: For each IMF index, we measure the difference in class-level variance between the source class and the target class, and normalise across IMFs. IMFs whose variance differs most between classes are perturbed first, under the assumption that these modes carry the strongest class-discriminative signal. – extremes: In this case, IMFACT computes the same distance as in distance, and then keep only the strongest and weakest IMF distances per channel, setting all other weights to zero. This focuses perturbation on a single most-different IMF and a single least-different IMF, yielding a highly sparse selection. – coarse_to_fine: We unlock IMFs gradually from coarse to fine scales over iterations. At early iterations only the coarsest (lowest-frequency) IMF is eligible for substitution. Every scoarse iterations one additional, finer IMF becomes active. Within the active set, distances are computed as in distance and normalised across IMFs. 3.4
Multi-NUN Extension
The basic IMFACT framework uses a single NUN as the target-class reference. To reduce dependence on any single neighbour and to enrich the pool of candidate (i) IMFs, we introduce a multi-NUN extension that retrieves the n NUNs {xNUN }ni=1 from the training set. At each substitution step s, IMFACT chooses from this set according to one of two policies: – cycle: IMFACT cycles through the n NUNs in round-robin order. At step s, the next IMF is taken from NUN i = (s mod n), ensuring that all NUNs contribute IMFs through the counterfactual search rather than relying on a single reference. – closest: At each step, for the IMF index k selected by the current strategy, (i) IMFACT chooses the NUN whose corresponding IMF ck is closest in L2 distance to the query IMF ck . This greedily selects the most similar targetclass mode for substitution at that scale.
4
Experimental Setup
In this section, we describe the experimental protocol used to evaluate IMFACT. We first outline the benchmark datasets (subsection 4.1) and classifier architecture (subsection 4.2), then detail the counterfactual evaluation metrics (subsection 4.3) and baseline methods (subsection 4.4), which are tested against IMFACT.
Counterfactual Explanations via Intrinsic Mode Function Substitution
4.1
7
Datasets
Our experiments use two benchmark datasets from the Time Series Classification (TSC) website [14] (which hosts and standardizes the UCR archive [2]) to ensure comparability with prior work on time series counterfactual explanations: – FaultDetectionA [12] contains one-dimensional accelerometer recordings from an electromechanical drive system with three operating conditions (healthy and two fault classes). The signals are recorded under controlled laboratory conditions and capture characteristic bearing and shaft vibration patterns that change when faults occur, making this dataset representative of the predictive-maintenance setting in which EMD has been widely applied [11,25]. – FruitFlies consists of wing-beat recordings from different Drosophila species, where each univariate time series encodes an individual fly’s oscillatory wingbeat pattern over time. The task is to distinguish species based on subtle differences in frequency content and waveform shape, providing a complementary biological benchmark to the mechanical signals of FaultDetectionA. We use the standard train–test split defined on the TSC website, treating each univariate time series as a single-channel input to the classifier. Both datasets exhibit non-stationary, oscillatory behavior, with class-discriminative information concentrated in specific frequency bands rather than at individual time points, which makes them suited for evaluating IMF-based counterfactuals built on EMD. 4.2
Classifier
We use a lightweight Convolutional Neural Network (SimpleCNN) implemented in PyTorch [15] as the black-box classifier across all experiments, following Schlegel and Seidl [20]. The architecture comprises four convolutional blocks, each consisting of a Conv1d layer with a stride of 2, batch normalization, ReLU activation, and dropout, followed by two fully-connected layers with batch normalization and dropout, and a softmax output layer. The four convolutional layers use 16, 32, 64, and 128 channels, respectively, with kernel sizes of 5, 5, 3, and 3, progressively downsampling the input; the fully connected layers reduce the flattened representation to 256 and then to 128 units before the final classification head. The model takes a single-channel time series of length T as input and outputs the softmax probabilities over the target classes. The model achieves an F1 score of 0.99 on the FaultDetectionA test dataset and 0.87 on the FruitFlies test dataset. Since IMFACT is model-agnostic and only requires black-box query access, the choice of classifier does not affect the counterfactual generation procedure itself. 4.3
Evaluation Metrics
We report a mixture of standard counterfactual metrics and aggregate scores inspired by a Keane-style evaluation [9], computed from per-instance quantities and then averaged over the evaluated set. Specifically, we measure Validity, the proportion of x for which one valid counterfactual x′ is found; Average L2, the
8
U. Schlegel et al.
average Euclidean distance ∥x′ − x∥2 between sample and cf; Pct. Changed, the fraction of points that differ between x and x′ (one minus sparsity); Range Val., the fraction of time steps in x′ that remain within the empirical value range observed for the target class in the training data; Autocorr., the average Pearson correlation between the lag-1 autocorrelation profiles of x and x′ ; and Time, the average time needed to generate a counterfactual for a single query. 4.4
Baselines
We compare IMFACT against two widely used counterfactual baselines and one more recent approach, which is suitable for long time series data: – Wachter [23]: A model-agnostic optimization-based method originally proposed for tabular data. It formulates counterfactual generation as minimizing a loss that trades off proximity to the original instance against a loss enforcing the desired target class, without making any time-series-specific assumptions. – Native Guide [4]: An instance-based method specifically designed for time series. Native Guide retrieves a Nearest Unlike Neighbor from the training set and uses a class-discriminative weight vector (e.g., derived from class activation maps) to highlight and perturb the most important regions of the series towards the guide, thereby producing sparse, proximal counterfactuals. – Glacier [24]: A latent-space counterfactual method for time series. Glacier performs locally constrained optimization over an autoencoder’s latent space, explicitly enforcing smoothness and neighborhood consistency, guided by saliency constraints that localize perturbations to yield more targeted edits. For a fair comparison, all four methods (IMFACT, Native Guide, Wachter, Glacier) are evaluated on the same 50 randomly selected test instances per dataset using the implementation of Schlegel and Seidl [20]. Experiment results and source code can be found online with more in-depth analysis 7 .
5
Results
We structure the evaluation in two parts. First, we present a combined ablation across the IMF-selection strategy and the multi-NUN configuration, on both datasets, to assess how both design choices jointly affect proximity, plausibility, and runtime. Second, we compare the best-performing IMFACT configuration against Native Guide, Wachter, and Glacier on both datasets to situate IMFACT within the broader landscape of time series counterfactual methods. 5.1
IMF-Strategy and Multi-NUN Ablation
We ablate two design choices jointly: the IMF-selection strategy (distance, variance, extremes, coarse_to_fine) and the multi-NUN configuration – the 7
Code and results can be found in the CFTS Github Repo at cf_imfact.
Counterfactual Explanations via Intrinsic Mode Function Substitution
9
number of neighbours (n ∈ {1, 2, 3, 5}) and, for the distance strategy specifically, the neighbour-selection policy (cycle rotates round-robin through the NUN pool; closest greedily selects the locally nearest NUN at each step). distance is the only strategy for which a closest-policy sweep was run; all other strategy rows use cycle. The full grid comprises 19 configurations per dataset (38 total), all of which reach full success (100.0%), so there is no failure case anywhere in this ablation. Table 1 reports the best- and second-best-performing configurations by each metric, the fastest configuration, our recommended default, and a weakeststrategy reference point, on both datasets (Success and Pct. Changed are omitted, since every configuration reaches 100.0% success and ≥ 99.9% Pct. Changed); the full grid is provided in the project repository.8 Table 1. Highlights of the combined IMF-strategy × multi-NUN ablation. distance (dist), variance (var), extremes (ext), coarse_to_fine (ctf); cycle (cyc), closest (clst). Bold/underline mark the best/second-best value per column across the grid per dataset; the var reference row is unmarked. Full grid in the project repo. Average Range Autocorr. Time (s) L2 Val.
FaultDetectionA
Highlight
ext_n1_cyc Best L2; best range validity 13.476 0.959 ext_n3_cyc 2nd-best L2; 2nd-best range validity 13.952 0.954 ctf_n3_cyc Best autocorrelation 14.832 0.947 ctf_n5_cyc 2nd-best autocorrelation 14.941 0.947 dist_n1_cyc Fastest 17.478 0.938 dist_n3_cyc Recommended default 16.241 0.943 dist_n5_clst Best autocorr. under clst 17.929 0.934 var_n1_cyc Weakest strategy (reference) 25.494 0.903
0.634 0.762 0.886 0.882 0.750 0.802 0.804 0.805
0.905 0.968 0.799 0.825 0.375 0.415 0.455 11.022
FruitFlies
Data Config.
ext_n3_cyc Best L2 ext_n5_cyc 2nd-best L2 ctf_n3_cyc Best range validity dist_n3_clst 2nd-best range validity dist_n2_clst Best autocorrelation dist_n2_cyc 2nd-best autocorrelation dist_n3_cyc Fastest; recommended default var_n3_cyc Weakest strategy (reference)
0.989 0.992 0.995 0.995 0.997 0.996 0.994 0.988
0.795 0.814 0.684 0.537 0.569 0.514 0.449 5.494
0.650 0.994 0.679 0.994 0.744 0.998 0.698 0.997 0.781 0.992 0.714 0.996 0.696 0.996 1.121 0.985
Reading across the two blocks separates the two ablation effects. Strategy effect: on FaultDetectionA, extremes gives the best proximity and range validity, while coarse_to_fine gives the best autocorrelation preservation; variance is the weakest strategy by a wide margin, way slower than any other strategy and worst on both L2 (25.494) and range validity (0.903) at its best-performing n. On FruitFlies, coarse_to_fine and extremes again lead on plausibility and proximity, and variance is again the slowest and least proximal strategy. 8
Ablation grid for the datsets: https://github.com/visual-xai-for-time-series/ counterfactual-explanations-for-time-series/tree/main/cfts/cf_imfact
10
U. Schlegel et al.
Multi-NUN effect: within the distance strategy,the only one with both n and policy varied, cycle outperforms closest on proximity at every neighbour count on FaultDetectionA (e.g. 16.241 vs. 18.619 at three neighbours), while on FruitFlies the ordering reverses at five neighbours, where closest becomes the most proximal configuration in the entire distance block (0.687). closest does, however, attain the best autocorrelation preservation on FaultDetectionA at five neighbours (0.804, multi_nun_closest_n5) and the outright best autocorrelation preservation on FruitFlies at two neighbours (0.997, multi_nun_closest_n2), so the closest policy is not uniformly worse, it simply trades proximity for plausibility in most settings. We settled on distance, n = 3, cycle as the recommended default because it is consistently near the top of the grid on both datasets without being a narrow single-metric winner: best-or-near-best range validity on FaultDetectionA (0.943) and within 0.009 of the best FruitFlies L2 (0.696 vs. 0.687), while avoiding the runtime volatility discussed next. On runtime: distance configurations are the fastest strategy on both datasets (0.375–0.455s on FaultDetectionA, 0.449–0.569s on FruitFlies, excluding one outlier discussed below). variance configurations are consistently and substantially the slowest (11.0–11.1s on FaultDetectionA, 5.5–5.6s on FruitFlies); extremes and coarse_to_fine sit in an intermediate band (roughly 0.76–1.04s on FaultDetectionA, 0.66–0.98s on FruitFlies) that was stable in the latest pass but showed order-of-magnitude spikes in earlier passes, so we would still recommend averaging over additional runs before treating any intermediate-band figure as final. One remaining single-point anomaly, visible in the full repository grid: multi_nun_closest_n5 on FruitFlies measured at 5.301s in the latest pass versus 0.53–0.61s previously and versus every neighbouring configuration in the same block, which we treat as noise rather than a genuine cost. 5.2
Baseline Comparison
Table 2 reports the direct comparison of IMFACT against Wachter [23], Native Guide [4], and Glacier [24] on both datasets. IMFACT is one of three methods to reach full validity on FaultDetectionA (100.0%, tied with Glacier and Native Guide) and one of two to reach full validity on FruitFlies (100.0%, tied with Native Guide); Wachter reaches only partial validity on both datasets (58.0% and 30.0%), and Glacier’s validity collapses to 36.0% on FruitFlies despite being fully valid on FaultDetectionA. Figure 2 shows a representative successful instance from each dataset, illustrating how the four methods differ in the shape of the counterfactuals they produce even when all reach validity. On FaultDetectionA, Native Guide [4] reaches full validity in aggregate, but has the lowest range validity of the four methods on this dataset (0.922) and, notably, changes only 58.974% of timesteps on average (Table 2) versus 100% for every other method, confirming that its edits are concentrated in a small region rather than spread across the series. On FruitFlies, Native Guide also reaches full validity and, in fact, attains the lowest L2 distance of any method (0.871) and the highest autocorrelation preservation (0.989), narrowly ahead of IMFACT, despite changing only 54.534% of timesteps on average, the lowest Pct.
Counterfactual Explanations via Intrinsic Mode Function Substitution
11
Data
Method
Validity (%)
Average L2
Pct. Changed
Range Val.
Autocorr.
Time (s)
FaultDetectionA
Glacier IMFACT Native Guide Wachter
100.0 100.0 100.0 58.0
8.788 18.862 20.843 14.751
99.961 100.000 58.974 99.997
0.936 0.939 0.922 0.947
0.960 0.685 0.837 0.825
1.327 0.388 7.218 11.792
FruitFlies
Table 2. Baseline comparison against Wachter [23], Native Guide [4], and Glacier [24]. Bold/underline mark best/second-best per column within each dataset, excluding Time and Pct. Changed; Validity is unmarked wherever methods tie for best. FruitFlies figures are carried over from the previous measurement pass (subsection 5.1).
Glacier IMFACT Native Guide Wachter
36.0 100.0 100.0 30.0
3.550 0.922 0.871 1.070
99.984 99.976 54.534 100.000
0.198 0.984 0.980 0.959
0.174 0.987 0.989 0.985
19.575 0.239 111.910 0.059
Changed of any method on either dataset. Its main drawback is computational cost: Native Guide is roughly 19× slower than IMFACT on FaultDetectionA, a ratio that has held consistently across repeated measurement passes even as the absolute times drifted (8.901s vs. 0.471s in one pass, 7.218s vs. 0.388s in the latest). On FruitFlies, the available measurements disagree substantially on magnitude (Native Guide at ∼ 43× slower in one run and ∼ 468× slower, 111.910s vs. 0.239s, in another), so while Native Guide is consistently and substantially the slower method, we do not report a specific multiplier for FruitFlies pending a more stable runtime measurement. Wachter et al. [23] shows a different trade-off: on FaultDetectionA it achieves lower L2 (14.751) and higher range validity (0.947) than IMFACT whenever it succeeds, and it remains among the fastest methods on FruitFlies (0.059s), but it succeeds on only 58.0% of FaultDetectionA instances and 30.0% of FruitFlies instances. This confirms the well-known limitation that unconstrained gradientfree optimisation frequently fails to reach the decision boundary, even when the counterfactuals it does produce look reasonable in isolation [20]; Figure 2 illustrates the correspondingly larger visual departure from the original signal that Wachter’s successful counterfactuals still exhibit. Wachter’s own runtime on FaultDetectionA has been especially unstable across measurement passes, rising from 3.888s to 11.792s, now the slowest of the four methods on this dataset, which we flag as a further symptom of the runtime measurement noise discussed above rather than a stable characterisation of the method. Glacier [24] is the strongest method on FaultDetectionA by nearly every metric other than validity, where it ties IMFACT and Native Guide at 100.0%: it attains the lowest L2 (8.788) and the highest autocorrelation preservation (0.960) of any method on this dataset. This strength does not transfer to FruitFlies, however, where Glacier’s validity collapses to 36.0% and its range validity and autocorrelation preservation both fall below 0.2 (0.198 and 0.174, respectively),
12
U. Schlegel et al.
indicating that a large fraction of its counterfactuals fall outside the plausible signal range entirely. IMFACT is the only method that achieves full validity on both datasets while avoiding both of these failure modes: Glacier’s dataset-dependent collapse and Native Guide’s high computational cost. Its own proximity and plausibility metrics are not uniformly best, Glacier is more proximal and better at preserving autocorrelation on FaultDetectionA, and Native Guide is marginally more proximal on FruitFlies, but IMFACT is the only method to combine full validity, competitive plausibility (range validity of 0.939 and 0.984 on FaultDetectionA and FruitFlies, respectively), and low runtime (0.388s on FaultDetectionA; 0.239–0.271s across FruitFlies measurement passes) consistently across both settings. Notably, IMFACT has also been the most stable method on runtime across repeated measurement: while Glacier, Native Guide, and Wachter have each shown multisecond to two-orders-of-magnitude swings between passes, IMFACT’s runtime has stayed within a narrow band on both datasets. Summary – Each baseline exhibits a distinct failure mode that IMFACT avoids: Glacier’s validity collapses on FruitFlies, Wachter reaches the decision boundary only partially on either dataset, and Native Guide matches IMFACT’s validity but at far higher and less stable runtime. IMFACT is thus the only method combining validity, plausibility, and stable low runtime across datasets.
Fig. 2. Counterfactual waveforms for representative instances on FaultDetectionA (sample 25, true class 0, left) and FruitFlies (sample 43, true class 0, right). All four methods (IMFACT, Native Guide, Wachter, and Glacier) reach a valid counterfactual on both instances. IMFACT, Native Guide, and Glacier track the original signal’s morphology closely on both datasets, while Wachter produces a visibly more divergent waveform on both instances despite reaching validity, illustrating that validity alone does not guarantee visual proximity to the original signal.
Counterfactual Explanations via Intrinsic Mode Function Substitution
6
13
Discussion
Why EMD works as a perturbation space – IMFs are physically interpretable and hierarchically ordered in terms of influence. In vibration signals, high-index IMFs capture bearing resonance and fault-characteristic frequencies, while lowindex IMFs encode broadband noise [11,25]. In our ablation (Table 1), it is extremes rather than variance that yields the closest, most plausible counterfactuals, and coarse_to_fine that best preserves autocorrelation. This suggests the classifiers are more sensitive to localized amplitude extrema than to the single most energetically dominant mode: substituting that mode wholesale, as variance does, requires the fewest search iterations (12–20 vs. 61–103 for the other strategies) but each such step is far larger and costlier, leaving variance both the least proximal strategy and, by over 10×, the slowest. Reaching the decision boundary quickly along the variance axis evidently means overshooting it in signal space, though we infer this from aggregate ablations rather than from direct evidence that IMF tracks what the classifier actually uses; confirming it would need instance-level checks such as attributions to individual IMFs [18]. On evaluation and multi-metric validation – A single validity metric is insufficient for assessing counterfactual quality [3], because each baseline in our study looks strong on validity alone while failing along others. Glacier [24] reaches full validity and the best proximity and autocorrelation on FaultDetectionA, yet its validity collapses to 36.0% on FruitFlies, where its remaining counterfactuals are also implausible (range validity and autocorrelation both < 0.2); a validity score computed on a single dataset would miss this dataset-dependent collapse. Wachter et al. [23] is only partially valid on both datasets (58.0%, 30.0%), so its seemingly competitive proximity is measured over an easier subset of instances rather than the full evaluation set. Native Guide [4] reaches full validity and even leads on FruitFlies proximity and autocorrelation, but does so by concentrating its edits in a small region of the series, changing only 54.5–59.0% of timesteps versus roughly 100% for the other methods; this is a plausibility problem that validity and proximity alone cannot reveal. Together these cases show that validity, proximity, and plausibility can each look good in isolation while masking a failure visible only in another metric, which is why we report them jointly, alongside runtime, rather than relying on any single score [10,20,22]. For the same reason, we report runtime stability rather than a single measurement: several baselines’ wall-clock times varied by an order of magnitude or more across repeated passes (subsection 5.1), so a one-shot timing figure would be misleading on its own. Generality and transferability – EMD applies to any non-stationary oscillatory signal without domain-specific adaptation. The FruitFlies results confirm transfer to a biological signal with a different frequency profile: IMFACT is the only method to reach full validity on both datasets while remaining plausibility-competitive (range validity 0.939 and 0.984) and runtime-stable across measurement passes. The NUN-guided substitution is also classifier-agnostic, requiring no gradients or model internals, making it applicable to any black-box classifier, with natural extensions to electroencephalography and financial time series, which share the non-stationary character IMF decomposition targets [8,13].
14
7
U. Schlegel et al.
Conclusions, Limitations and Future Work
This work presented IMFACT, a model-agnostic framework for counterfactual explanation of time series classifiers that operates in the EMD space. By decomposing signals into physically meaningful IMFs and substituting them with IMFs drawn from a NUN, IMFACT produces counterfactuals that are valid, proximal, and plausible in temporal structure and value range. Across IMF-selection strategies and multi-NUN configurations on two benchmark datasets, nearly all variants achieved high success rates while preserving key signal characteristics; the one exception, maxmin on FaultDetectionA, shows strategy choice can be dataset-dependent rather than universal. No single strategy dominates, variance is consistently most plausible, but the most proximal strategy varies by dataset, while cyclic multi-NUN with three neighbours offers the most consistent overall trade-off. Against Wachter, Native Guide, and Glacier, IMFACT is the only method to reach full validity on both datasets, with substantially lower and more stable runtime than the strongest competing baselines. These findings support signal-decomposition-native perturbation spaces for time series counterfactual explanation, particularly where frequency content and temporal coherence are critical to a plausible explanation. Limitations and future work – The evaluation uses sampled subsets of two datasets; full-dataset evaluation across more UCR benchmarks with confidence intervals over multiple seeds is needed to confirm generality. Single-sample traces show sensitivity to the specific NUN retrieved, and all experiments use a SimpleCNN, so behaviour on deeper architectures (ResNet, InceptionTime, Transformers) with more complex decision boundaries remains untested; IMFACT is model-agnostic by construction but this has not been verified empirically. The method is also currently limited to univariate series, extending to multivariate data requires a principled way to align IMFs across channels. Two further limitations concern the core mechanism itself: (i) EMD is prone to mode mixing, so the same IMF index need not correspond to the same physical phenomenon across the query and NUN, and our zero-padding heuristic for K ̸= K ′ does not resolve this; and (ii) the greedy, one-IMF-at-a-time search is not guaranteed to find the globally sparsest or most proximal counterfactual, and the bestperforming IMF-selection strategy varies by dataset (e.g. maxmin fails outright on FaultDetectionA), so some per-dataset tuning is currently required rather than a single default that works everywhere. On the computational side, variance is the slowest strategy despite using the fewest iterations (11–13 vs. 61–103 on FruitFlies), since each substitution targets a large, energetically dominant IMF; Ensemble EMD or Variational Mode Decomposition [5] could reduce this cost. We also observed runtime volatility of up to two orders of magnitude across repeated passes for the baselines, while IMFACT’s runtime stayed stable; a more controlled timing protocol is needed before drawing firm conclusions about relative runtime. Finally, we plan to add further plausibility metrics (density-based measures, adversarial detectability, human ratings) to more comprehensively assess realism and trustworthiness.
Counterfactual Explanations via Intrinsic Mode Function Substitution
15
Acknowledgments. We thank the creators of the UCR/UEA Time Series Archive for enabling rigorous evaluation of these methods. We are also grateful to the researchers whose work we reviewed for their contributions to interpretable machine learning.
References 1. Chukwu, E.C., Schouten, R.M., Tabak, M., Pechenizkiy, M.: Counterfactual Explanations for Time Series Should be Human-Centered and Temporally Coherent in Interventions. arXiv preprint arXiv:2512.14559 (2025) 2. Dau, H.A., Bagnall, A., Kamgar, K., Yeh, C.C.M., Zhu, Y., Gharghabi, S., Ratanamahatana, C.A., Keogh, E.: The UCR time series archive. IEEE/CAA Journal of Automatica Sinica (2019) 3. Del Ser, J., Barredo-Arrieta, A., Díaz-Rodríguez, N., Herrera, F., Saranti, A., Holzinger, A.: On generating trustworthy counterfactual explanations. Information Sciences (2024) 4. Delaney, E., Greene, D., Keane, M.T.: Instance-based counterfactual explanations for time series classification. In: International Conference on Case-Based Reasoning (2021) 5. Dragomiretskiy, K., Zosso, D.: Variational mode decomposition. IEEE transactions on signal processing (2013) 6. Guidotti, R.: Counterfactual explanations and how to find them: literature review and benchmarking. Data Mining and Knowledge Discovery (2022) 7. Guidotti, R., Monreale, A., Ruggieri, S., Turini, F., Giannotti, F., Pedreschi, D.: A survey of methods for explaining black box models. ACM Computing Surveys (2018) 8. Huang, N.E., Shen, Z., Long, S.R., Wu, M.C., Shih, H.H., Zheng, Q., Yen, N.C., Tung, C.C., Liu, H.H.: The empirical mode decomposition and the hilbert spectrum for nonlinear and non-stationary time series analysis. Proceedings of the Royal Society of London. Series A: mathematical, physical and engineering sciences (1998) 9. Keane, M.T., Kenny, E.M., Delaney, E., Smyth, B.: If only we had better counterfactual explanations: Five key deficits to rectify in the evaluation of counterfactual xai techniques. International Joint Conference on Artificial Intelligence (2021) 10. Kostrzewa, M., Galus, K., Zięba, M.: Towards plausibility in time series counterfactual explanations. arXiv preprint arXiv:2603.08349 (2026) 11. Lei, Y., Lin, J., He, Z., Zuo, M.J.: A review on empirical mode decomposition in fault diagnosis of rotating machinery. Mechanical systems and signal processing (2013) 12. Lessmeier, C., Kimotho, J.K., Zimmer, D., Sextro, W.: Condition monitoring of bearing damage in electromechanical drive systems by using motor current signals of electric motors: A benchmark data set for data-driven classification. In: PHM Society European Conference (2016) 13. Luukko, P.J.J., Helske, J., Räsänen, E.: Introducing libeemd: A program package for performing the ensemble empirical mode decomposition. Computational Statistics (2016) 14. Middlehurst, M., Ismail-Fawaz, A., Guillaume, A., Holder, C., Guijo-Rubio, D., Bulatova, G., Tsaprounis, L., Mentel, L., Walter, M., Schäfer, P., Bagnall, A.: aeon: a python toolkit for learning from time series. Journal of Machine Learning Research (2024)
16
U. Schlegel et al.
15. Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al.: Pytorch: An imperative style, highperformance deep learning library. Advances in neural information processing systems (2019) 16. Płudowski, D., Spinnato, F., Wilczyński, P., Kotowski, K., Ntagiou, E.V., Guidotti, R., Biecek, P.: Mascots: Model-agnostic symbolic counterfactual explanations for time series. In: Joint European Conference on Machine Learning and Knowledge Discovery in Databases (2025) 17. Rudin, C.: Stop explaining black box machine learning models for high stakes decisions and use interpretable models instead. Nature Machine Intelligence (2019) 18. Schlegel, U., Oelke, D., Keim, D.A., El-Assady, M.: Visual Explanations with Attributions and Counterfactuals on Time Series Classification. arXiv preprint arXiv:2307.08494 (2023) 19. Schlegel, U., Rauscher, J., Keim, D.A.: Interactive Counterfactual Generation for Univariate Time Series. In: Workshop on eXplainable Knowledge Discovery in Data Mining (XKDD) (2024) 20. Schlegel, U., Seidl, T.: What-if explanations over time: Counterfactuals for time series classification. In: World Conference on Explainable Artificial Intelligence (XAI) (2026) 21. Theissler, A., Spinnato, F., Schlegel, U., Guidotti, R.: Explainable AI for time series classification: a review, taxonomy and research directions. IEEE Access (2022) 22. Verma, S., Boonsanong, V., Hoang, M., Hines, K., Dickerson, J., Shah, C.: Counterfactual explanations and algorithmic recourses for machine learning: A review. ACM Computing Surveys (2024) 23. Wachter, S., Mittelstadt, B., Russell, C.: Counterfactual explanations without opening the black box: Automated decisions and the GDPR. Harv. JL & Tech. (2017) 24. Wang, Z., Samsten, I., Miliou, I., Mochaourab, R., Papapetrou, P.: Glacier: guided locally constrained counterfactual explanations for time series classification. Machine Learning (2024) 25. Wu, Z., Huang, N.E.: Ensemble empirical mode decomposition: a noise-assisted data analysis method. Advances in adaptive data analysis (2009)
Related documents
- Counterfactual Explanations for Time Series Through Local Pattern Mining and Generative Models#176212
- TimEE: End-to-end Time Series Classification via In-Context Learning#349635
- Intrinsic units: identifying a system’s causal grain.#14788
- PACE-FNO: Physics-Aligned Canonical Equivariance for Fourier Neural Operators#1117425
- Dynamic models with $p$ parameters are identified by $2p+1$ random features#927385
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive