Abstract
MASCOTS (Model-Agnostic Symbolic COunterfactual Explanations for Time Series) is a novel framework designed to provide interpretable explanations for black-box time series classification models. Unlike traditional methods that rely on raw data perturbations or model-specific gradients, MASCOTS operates in a symbolic feature space. By transforming raw signals into high-level patterns and iteratively swapping them, the framework generates counterfactual explanations that are sparse, plausible, and translatable into natural language. Empirical evaluations across diverse datasets demonstrate that MASCOTS achieves high validity and superior sparsity compared to state-of-the-art baselines.
Introduction
In Time Series Classification (TSC), high-performance models like InceptionTime or HIVE-COTE are frequently deployed as "black boxes," offering high accuracy but little transparency regarding their decision-making processes. While traditional Explainable AI (XAI) techniques often utilize saliency maps to highlight influential regions of a signal, these maps fail to provide actionable insights. Counterfactual explanations address this by answering the question: "What is the minimal change required to flip a prediction from one class to another?"
However, generating counterfactuals for time series is challenging due to high dimensionality and temporal dependencies. Existing methods often produce "adversarial" changes—noise-like perturbations that lack semantic meaning—or require access to model gradients, limiting their applicability. MASCOTS overcomes these hurdles by bridging the gap between raw numerical data and symbolic reasoning.
Methodology
The MASCOTS pipeline consists of five primary stages designed to ensure model-agnosticism and interpretability:
- Symbolic Transformation (BoRF): The framework converts raw time series data into a Bag-of-Receptive-Fields (BoRF) representation. Using Symbolic Aggregate Approximation (SAX), subsequences are transformed into discrete "words" (e.g., a sequence like
[0, 2, 2]representing a specific shape motif). - Surrogate Modeling: To maintain model-agnosticism, MASCOTS trains a simple, interpretable surrogate model to mimic the behavior of the complex black-box classifier using the symbolic features.
- Feature Attribution: Utilizing Deep SHAP, the system identifies which symbolic words most strongly support the current prediction and which words are characteristic of the target class.
- Iterative Pattern Swapping: The algorithm identifies the most "negative" pattern (the one most strongly supporting the original, undesired class) and replaces it with a "positive" pattern from the target class. This process repeats until the black-box model’s prediction is successfully flipped.
- Natural Language Generation: Because MASCOTS operates on discrete symbols, it can generate human-readable explanations, such as: "To change the prediction from 'Abnormal' to 'Normal', the pattern at index 10-25 must be replaced with [2, 2, 1, 0]."
Experimental Evaluation
The researchers evaluated MASCOTS using a diverse set of benchmarks from the UEA and UCR repositories. The evaluation covered both univariate datasets (e.g., TwoLeadECG, GunPoint, Coffee) and multivariate datasets (e.g., BasicMotions, Epilepsy). The framework's performance was measured against several metrics, including validity (success rate in flipping predictions), sparsity (the percentage of the signal modified), and plausibility (the realism of the generated signal).
Key Results and Insights
Sparsity and Interpretability
MASCOTS significantly outperformed gradient-based baselines like Glacier in terms of sparsity. While traditional methods often modify every data point in a series, MASCOTS typically modifies less than 30% of the original features. By perturbing "words" (shapes) rather than individual pixels, the changes remain semantically meaningful, corresponding to recognizable motifs like peaks or valleys.
Model-Agnosticism
Because MASCOTS relies on a surrogate model and does not require gradient information, it can explain non-differentiable models. This was demonstrated by successfully explaining MultiRocket-Hydra, an ensemble of convolutional kernels that most existing explainers cannot process.
Validity and Plausibility
On univariate data, MASCOTS achieved a validity score of 41%–44%, comparable to state-of-the-art methods. Furthermore, using Isolation Forests to assess data distribution, MASCOTS maintained high plausibility scores (~0.98), ensuring that counterfactual signals remain realistic and do not appear as outliers.
Conclusion and Future Work
MASCOTS represents a significant step toward human-centric XAI for time series. By operating in a symbolic space, it provides sparse and actionable explanations that domain experts can easily interpret. While the framework faces challenges in multivariate synchronization and surrogate fidelity, future work aims to implement a "user-in-the-middle" framework. This would allow experts, such as clinicians or engineers, to interactively select between proposed symbolic changes, making the tool a collaborative partner in decision-making.
Summary updated