Skip to content
AI.info

Research

Counterfactual Explainable AI (XAI) Method for Deep Learning-Based Multivariate Time Series Classification

Overview Research area: Explainable AI (XAI) for deep learning, specifically Counterfactual Explanations (CE) for multivariate time series (MTS) classification. Technical level: Intermediate. The pape

arXiv
2511.13237
Published
2025-11-17
Authors
Alan G. Paredes Cetina, Kaouther Benguessoum, Raoni Lourenço, Sylvain Kubler

AI summary

Overview

Research area: Explainable AI (XAI) for deep learning, specifically Counterfactual Explanations (CE) for multivariate time series (MTS) classification.

Technical level: Intermediate. The paper assumes familiarity with time series classification, XAI desiderata (validity, confidence, sparsity, proximity, plausibility), Class Activation Maps (CAMs), and multi-objective evolutionary optimization (NSGA-III).

Scope: The paper introduces and benchmarks confetti (COuNterFactual Explanations for mulTivariate Time serIes), a multi-objective counterfactual explanation method for deep-learning-based MTS classifiers, evaluated on seven UEA-archive datasets with two model architectures (FCN and ResNet).

What This Paper Is About

Deep learning models classify multivariate time series well, but they do not explain their decisions. Existing counterfactual explanation methods for time series typically optimize only one objective at a time — either prediction confidence, sparsity, or proximity — which limits how useful their explanations are in practice. This paper proposes confetti, a method that jointly balances prediction confidence, proximity, and sparsity while guaranteeing plausibility and validity by design, and benchmarks it against CoMTE, SETS, and TSEvo.

Key Contributions

  1. A novel multi-objective CE method for MTS that optimizes prediction confidence, proximity, and sparsity simultaneously, while ensuring plausibility and validity by design.
  2. A comprehensive benchmark against the CoMTE, SETS, and TSEvo CE methods, conducted on seven datasets from the UEA archive using two model architectures.
  3. An ablation study of the initial stage, showing how the search for the most influential subsequence through feature weights affects performance.
  4. A sensitivity analysis of the method's parameters, examining how variations in their values affect performance.

Main Findings

  • Confidence (optimized objective): On all seven datasets, confetti consistently outperforms CoMTE and SETS on Counterfactual Confidence. With a stricter threshold (θ = 0.95) it achieves a mean confidence of 0.98, exceeding the best baseline (CoMTE, 0.86) by 0.02–0.22 across datasets — most notably on NATOPS, improving from 0.76 to 0.98. At the default θ = 0.51, its mean confidence (0.70) is slightly below CoMTE's but remains competitive on four datasets and clearly outperforms SETS on BasicMotions, ERing, Epilepsy, and RacketSports. Per-dataset values at θ = 0.95 are: AWR 0.978, BasicMotions 0.965, ERing 0.981, Epilepsy 0.972, Libras 0.973, NATOPS 0.976, RacketSports 0.980.
  • Sparsity (optimized objective): confetti outperforms both CoMTE and TSEvo on every dataset. With full emphasis on sparsity (α = 0.0) it reaches an average score of 0.88, ahead of CoMTE (0.56) and TSEvo (0.01); the balanced setting (α = 0.5) averages 0.85.
  • Aggregate FCN results: confetti variants score coverage 100, validity 1.00, sparsity 0.81–0.88, L1 99.76–146.19, L2 16.01–19.78, DTW 15.40–18.93, and yNN 0.99. Baselines on FCN: CoMTE COV 100, VAL 0.93, CONF 0.86, SPA 0.54, L1 283.55, L2 27.24, DTW 26.49, yNN 0.99; SETS COV 94.17, VAL 0.77, CONF 0.76, SPA 0.02, L1 923.58, L2 56.79, DTW 48.16, yNN 0.99; TSEvo COV 100, VAL 0.80, CONF 0.80, SPA 0.01, L1 954.54, L2 56.50, DTW 49.19, yNN 0.99.
  • Aggregate ResNet results: confetti scores coverage 100, validity 1.00, sparsity 0.82–0.88, L1 96.50–121.78, L2 14.94–16.47, DTW 14.22–15.68, and yNN 0.99. Baselines on ResNet: CoMTE COV 100, VAL 0.91, CONF 0.87, SPA 0.57, L1 269.82, L2 25.90, DTW 25.25; SETS COV 93.24, VAL 0.76, CONF 0.76, SPA 0.02, L1 920.46, L2 56.98, DTW 47.72; TSEvo COV 100, VAL 0.79, CONF 0.79, SPA 0.01, L1 954.39, L2 56.22, DTW 48.62.
  • Validity by design: confetti was the only method to reach a perfect validity score of 1 across both models and all datasets, indicating every CE changed the model prediction. CoMTE ranged between 0.79–0.80 and 0.91–0.93.
  • Coverage: All confetti variants achieved 100% coverage, matching CoMTE and TSEvo — CEs were generated for every instance.
  • Proximity: confetti achieved the lowest average L1, L2, and DTW distances across all settings, despite proximity not being explicitly optimized, because values are either retained from the original instance or replaced with values from the nearest unlike neighbor (NUN).
  • Plausibility: All methods, including confetti, achieved high yNN scores (0.99), confirming plausibility within the data distribution.
  • Abstract-level claim: confetti achieves ≥10% higher confidence while improving sparsity in ≥40%.
  • Theorem 1: Every counterfactual returned after the naive stage satisfies Hamming(C_j, X_i) ≤ Hamming(C_0, X_i), where C_0 is the initial counterfactual generated during the naive stage.

Methodology in Plain English

confetti works in four stages.

  1. Find a target. For the instance to be explained, the method retrieves its Nearest Unlike Neighbor (NUN) — the closest instance in the reference data whose predicted label differs from the instance's label. Candidates must exceed a confidence threshold θ; if none do, the process halts.
  2. Find the influential region. Using Class Activation Maps (CAM) averaged across channels, the method slides a window over the NUN's importance weights and picks the contiguous subsequence with the highest cumulative weight.
  3. Build an initial counterfactual (naive stage). The values of that subsequence in the original instance are replaced by the corresponding values from the NUN. Starting with subsequence length ℓ = 2, the length is increased until the classifier's confidence in the target class meets the threshold θ. In the most extreme case, all values of the original instance are replaced by those of the NUN.
  4. Optimize. The initial counterfactual seeds a multi-objective optimization using NSGA-III, which maximizes prediction confidence (m₁), minimizes the normalized Hamming distance for sparsity (m₂), and minimizes the distance between the original instance and the counterfactual for proximity (m₃), subject to the confidence constraint P(f(C_j) = c) ≥ θ. NSGA-III was chosen for its ability to maintain solution diversity via reference points generated using the Das-Dennis method in a 3-objective space. The population is initialized by Binary Random Sampling, and uses Two-Point Crossover and Bit-Flip Mutation. A binary search over the subsequence window progressively reduces the modified region: if a solution is found, the window shrinks; if not, it grows.

A weighting parameter α ∈ [0, 1] lets the user balance confidence against sparsity when selecting the best counterfactual, using the weight vector [α, 1−α]. confetti returns the full set of counterfactuals plus the best candidate. If a CAM feature-weight vector is unavailable (e.g., due to model architecture), the method skips the subsequence extraction and naive stages and proceeds directly to optimization, operating in a fully model-agnostic manner.

Experimental setup: Two models, Fully Convolutional Network (FCN) and Residual Network (ResNet), both supporting CAM extraction. Seven datasets from the Multivariate TSML Archive: ArticularlyWordRecognition (AWR; length 144, 9 dimensions, 25 classes), BasicMotions (100, 6, 4), Epilepsy (207, 3, 4), ERing (65, 4, 6), Libras (45, 2, 15), NATOPS (51, 24, 6), and RacketSports (30, 6, 4). Six criteria and eight metrics were used: Sparsity (SPA), Counterfactual Confidence (CONF), Plausibility (yNN with k = 5 nearest neighbors using DTW), Proximity (L1, L2, DTW), Coverage (COV), and Validity (VAL). Baselines were run with TSInterpret defaults plus specific settings: CoMTE with one distractor, 100 attempts, 100 iterations; SETS with minimum shapelet length of either three time steps or one-tenth of the series length (whichever is greater) and maximum shapelet length of either half the series length or one time step longer than the minimum (whichever is greater); TSEvo limited to 100 epochs. Implementation used Python 3.12, Keras 3.8.0, sktime 0.36.0, and TSInterpret 0.4.7, on a MacBook Pro (Apple M4 Max, macOS Sequoia 15.5, 36GB RAM), with official UEA train/test splits from sktime. Rankings were assigned via pairwise comparisons per dataset, with statistical significance confirmed by a paired Wilcoxon signed-rank test at α = 0.05. AB-CE was excluded due to lack of publicly available code, and LASTS was excluded because it produces multiple explanation types (counterfactuals, rules, and a surrogate model) rather than counterfactuals alone.

Why This Matters

Impact on research. Most prior CE methods for MTS optimize a single objective and rely on uninformed search (TSEvo's population-based exploration) or lack prior knowledge about the input space (CoMTE). confetti shows that informed guidance — using CAM-highlighted subsequences and NUNs — plus multi-objective optimization can improve several quality metrics at once rather than trading them off. It also provides a formal guarantee (Theorem 1) that optimized counterfactuals never require more changes than the naive initial one.

Real-world applications (the paper motivates counterfactuals with a financial-trading example where a broker sees a volatility spike but not that a slight drop would have changed the recommendation):

  • Finance: showing an analyst not just why a model recommends selling a stock, but what small change in volatility would have reversed that recommendation.
  • Healthcare monitoring: explaining which time segments of a patient's multivariate sensor record drove a classification and what minimal changes would alter it, while keeping values within the observed data distribution (plausibility).
  • Industrial and IoT sensor analytics: diagnosing model decisions on multi-channel sensor streams (e.g., BasicMotions, Epilepsy, NATOPS, RacketSports-style data) where actionable, sparse explanations matter operationally.
  • High-stakes decision support: the θ = 0.95 configuration targets scenarios requiring high reliability, whereas θ = 0.51 provides a general-use baseline.

Industry relevance. confetti offers explicit user control over the confidence–sparsity trade-off through α and θ, provides an interpretation path with or without CAM support (model-agnostic mode), and its public code is available at https://github.com/serval-uni-lu/confetti.

Future Directions

  • Broader baseline coverage. AB-CE and LASTS were excluded (no public code; multiple explanation types), so a fully reproducible comparison against the full CE landscape for MTS remains open.
  • Completing the reported analyses. The provided content truncates at the start of the execution-time discussion; the ablation study of the naive stage (RQ2), the parameter sensitivity analysis (RQ3), and the execution-time numbers are not reported in the available text.
  • Model-agnostic operation. The paper notes that when no feature-weight vector (CAM) is available, confetti skips subsequence extraction and the naive stage and runs a fully model-agnostic optimization — how much performance depends on CAM guidance is a natural follow-up question.
  • Extension beyond classification. The abstract frames deep learning's advances in terms of both MTS classification and regression, but the method and experiments address classification only; adapting the multi-objective formulation to regression targets is an open question raised by this framing.

Target Audience

Researchers and practitioners in explainable AI, time series analysis, and applied machine learning who need transparent, actionable explanations from deep classifiers. It is most valuable to those already familiar with counterfactual explanation concepts and multi-objective optimization, and to engineers deploying MTS classifiers in domains — such as finance, healthcare, and industrial sensing — where decision makers must understand not only why a prediction was made but what would have changed it.

Authors’ abstract

Recent advances in deep learning have improved multivariate time series (MTS) classification and regression by capturing complex patterns, but their lack of transparency hinders decision-making. Explainable AI (XAI) methods offer partial insights, yet often fall short of conveying the full decision space. Counterfactual Explanations (CE) provide a promising alternative, but current approaches typically prioritize either accuracy, proximity or sparsity -- rarely all -- limiting their practical value. To address this, we propose CONFETTI, a novel multi-objective CE method for MTS. CONFETTI identifies key MTS subsequences, locates a counterfactual target, and optimally modifies the time series to balance prediction confidence, proximity and sparsity. This method provides actionable insights with minimal changes, improving interpretability, and decision support. CONFETTI is evaluated on seven MTS datasets from the UEA archive, demonstrating its effectiveness in various domains. CONFETTI consistently outperforms state-of-the-art CE methods in its optimization objectives, and in six other metrics from the literature, achieving $\geq10\%$ higher confidence while improving sparsity in $\geq40\%$.

Read the original paper