Learnable Time-Frequency Masks for Explaining Time-Series Classifiers

Theresa Dahl Frehr, Francisco Pelayo, Lukas Raad, Alicia García Sanz, Thea Brüsch, Tommy Sonne AlstrømarXiv 2026

TL;DR

The paper introduces XACT (eXplainable Attributions from Coefficients of Transforms), a general framework that learns sparse, smooth explanation masks directly within arbitrary time-frequency domains (such as STFT, CWT, and DWT). By optimizing masks over transform coefficients and introducing an energy-aware penalty, XACT provides highly localized, structured, and human-interpretable explanations for deep time-series classifiers without highlighting spurious noise.

What Problem Does This Paper Address?

Deep learning models excel at time-series classification, but understanding why they make a prediction remains a notorious challenge. Traditional explainable AI (XAI) methods typically generate attributions in the raw time domain. However, the most discriminative features in time-series data (like audio, EEG, or financial data) are often encoded as latent frequency patterns or transient joint time-frequency events.

Existing time-frequency attribution methods are heavily restricted: they either operate on a single, fixed transform domain or suffer from high computational overhead and noisy outputs due to inefficient random sampling. This paper addresses the need for a flexible, transform-agnostic framework that can cleanly map a model's decisions back to any interpretable time-frequency representation.

Methods

The authors propose XACT, a framework that learns an explanation mask directly over the coefficients of any linear time-frequency transform that possesses a bounded left inverse.

Figure 1: Overview of the proposed method. A mask, M, of the same dimensions as the time-frequency representa- tion, g(x), is initialised randomly. An explanation is then the product of a learning problem tied to the mask using an objective function that enforces sparsity, smoothness and consistency between the original prediction of the model and the prediction of the masked input, g−1(g(x) ◦M).

As shown in Figure 1, the pipeline works by:

  1. Transforming the input signal $x$ into a time-frequency representation $g(x)$.
  2. Applying a learnable mask $M$.
  3. Inverting the masked representation back to the time domain via $g^{-1}$ to feed into the trained classifier $f(\cdot)$.
  4. Optimizing the mask via gradient descent using a multi-component loss function: $$\mathcal{L} = \mathcal{L}_D + \lambda_1\mathcal{L}_R + \lambda_2\mathcal{L}_S + \lambda_3\mathcal{L}_A$$

Where:

  • $\mathcal{L}_D$ (Consistency Loss): Ensures the model's prediction on the masked input matches its original prediction.
  • $\mathcal{L}_R$ (Sparsity Regularizer): An $\ell_1$-norm penalty that forces the mask to highlight only the most critical coefficients.
  • $\mathcal{L}_S$ (2D Smoothness Penalty): Extends total variation minimization to two dimensions (time and frequency) to ensure spatial coherence.
  • $\mathcal{L}_A$ (Energy-Aware Regularization): A novel penalty that discourages assigning relevance to empty or low-energy regions of the spectrogram/scalogram, effectively suppressing noise.

Additionally, the authors mathematically derive virtual inspection layers for both the Discrete Wavelet Transform (DWT) and Continuous Wavelet Transform (CWT), allowing Layer-wise Relevance Propagation (LRP)—a popular white-box XAI method—to be extended to wavelet domains for comparison.

Datasets

The framework was evaluated using three distinct datasets:

  1. Synthetic DTMF Dataset: A custom-generated dataset based on Dual-Tone Multi-Frequency signaling. It features 12 classes with precise ground-truth frequency locations mixed with random spurious frequencies and white noise, designed specifically to rigorously test feature localization.
  2. AudioMNIST: A real-world dataset consisting of spoken digits (0-9) from multiple speakers, converted into time-frequency representations.
  3. SleepEDF: A real-world medical dataset containing overnight EEG recordings used for automatic sleep stage classification (e.g., detecting REM sleep).

Key Insights and Ideas

  • Domain Flexibility Matters: Different signals benefit from different representations. For instance, the CWT handles non-stationary signals and sharp transients exceptionally well due to its multi-resolution nature, whereas the STFT uses a fixed window. XACT allows practitioners to choose the transform that best fits their specific data characteristics.
  • The Danger of "Empty" Relevance: Standard masking methods often highlight regions containing zero signal energy simply because modifying those regions doesn't change the model's output. XACT’s energy-aware penalty ($\mathcal{L}_A$) successfully forces the mask to focus only on where actual signal energy resides.
  • Faithfulness Metrics Can Deceive: The authors show that standard quantitative evaluation metrics like insertion curves can be poorly calibrated. For example, a baseline method (FreqRISE) achieved an insertion confidence score of 0.95 on a model that only had an actual accuracy of 80%, demonstrating that high metric scores do not always equate to a well-calibrated explanation.

Key Results

Synthetic Localization

On the synthetic dataset, XACT demonstrated near-perfect precision in identifying class-defining frequencies while ignoring highly distracting spurious noise.

Method Average Precision (AP) ↑ Precision@2 ↑
LRP $0.864 \pm 0.219$ $0.836 \pm 0.243$
FreqRISE $0.969 \pm 0.081$ $0.933 \pm 0.170$
XACT $\mathbf{0.970 \pm 0.128}$ $\mathbf{0.970 \pm 0.120}$
Visual comparison of explanations on the synthetic dataset, showing XACT's clean isolation of ground-truth frequencies.

Real-World Structure

When applied to the SleepEDF dataset to explain REM sleep classification, XACT produced significantly more compact, structured, and localized explanations than its baselines.

Figure 4: Explanation for a sample from SleepEDF belonging to the class of REM sleep. The time series itself is plotted in red on top of the representations with some smoothing to avoid too much jitter in the visualisation. Its y-axis is arbitrary. FreqRISE and XACT have been masked for energy. The CWT is plotted with a linear y-scale for easier comparison to the other representations, but with the consequence that the high frequencies are stretched vertically.

As visualized in Figure 4, while LRP and FreqRISE yielded diffuse, scattered attributions, XACT cleanly isolated a localized region around 5 Hz (associated with characteristic REM delta/theta activity) and captured beta-band activity (16–32 Hz) towards the end of the window, aligning perfectly with established sleep research literature.

Limitations and Future Work

While XACT consistently generates low-complexity, visually interpretable masks, no single XAI method outperformed all others across every real-world quantitative metric (such as raw deletion/insertion curves). Furthermore, the energy-masking threshold ($\tau$) is a hyperparameter that requires domain-specific tuning based on the background noise level of the dataset.

Future research directions could explore automatically learning the optimal time-frequency representation alongside the mask, or adapting the framework to handle multi-channel time-series data natively.

Summary updated

BibTeX
@misc{frehr2026learnable,
  author = {Theresa Dahl Frehr and Francisco Pelayo and Lukas Raad and Alicia García Sanz and Thea Brüsch and Tommy Sonne Alstrøm},
  title = {{Learnable Time-Frequency Masks for Explaining Time-Series Classifiers}},
  year = {2026},
  eprint = {2609.29270},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.29270},
}
Figure