Title: Encoding Time-Series Explanations through Self-Supervised Model Behavior Consistency
Venue: NeurIPS 2023
Accepted: yes
Keywords: Explainability

Interpretability

Time Series

Explanations

Temporal patterns

Model Understanding

Latent space

Self-supervised learning
Abstract: Interpreting time series models is uniquely challenging because it requires identifying both the location of time series signals that drive model predictions and their matching to an interpretable temporal pattern. While explainers from other modalities can be applied to time series, their inductive biases do not transfer well to the inherently challenging interpretation of time series. We present TimeX, a time series consistency model for training explainers. TimeX trains an interpretable surrogate to mimic the behavior of a pretrained time series model. It addresses the issue of model faithfulness by introducing model behavior consistency, a novel formulation that preserves relations in the latent space induced by the pretrained model with relations in the latent space induced by TimeX. TimeX provides discrete attribution maps and, unlike existing interpretability methods, it learns a latent space of explanations that can be used in various ways, such as to provide landmarks to visually aggregate similar explanations and easily recognize temporal patterns. We evaluate TimeX on eight synthetic and real-world datasets and compare its performance against state-of-the-art interpretability methods. We also conduct case studies using physiological time series. Quantitative evaluations demonstrate that TimeX achieves the highest or second-highest performance in every metric compared to baselines across all datasets. Through case studies, we show that the novel components of TimeX show potential for training faithful, interpretable models that capture the behavior of pretrained time series models.

Encoding Time-Series Explanations through Self-Supervised Model Behavior Consistency

Abstract

Interpreting time series models is uniquely challenging because it requires identifying both the location of time series signals that drive model predictions and their matching to an interpretable temporal pattern. While explainers from other modalities can be applied to time series, their inductive biases do not transfer well to the inherently challenging interpretation of time series. We present TIMEX, a time series consistency model for training explainers. TIMEX trains an interpretable surrogate to mimic the behavior of a pretrained time series model. It addresses the issue of model faithfulness by introducing model behavior consistency , a novel formulation that preserves relations in the latent space induced by the pretrained model with relations in the latent space induced by TIMEX. TIMEX provides discrete attribution maps and, unlike existing interpretability methods, it learns a latent space of explanations that can be used in various ways, such as to provide landmarks to visually aggregate similar explanations and easily recognize temporal patterns. We evaluate TIMEX on eight synthetic and real-world datasets and compare its performance against state-of-the-art interpretability methods. We also conduct case studies using physiological time series. Quantitative evaluations demonstrate that TIMEX achieves the highest or second-highest performance in every metric compared to baselines across all datasets. Through case studies, we show that the novel components of TIMEX show potential for training faithful, interpretable models that capture the behavior of pretrained time series models.

1 Introduction

Prevailing time series models are high-capacity pre-trained neural networks [1, 2], which are often seen as black boxes due to their internal complexity and lack of interpretability [3]. However, practical use requires techniques for auditing and interrogating these models to rationalize their predictions. Interpreting time series models poses a distinct set of challenges due to the need to achieve two goals: pinpointing the specific location of time series signals that influence the model's predictions and aligning those signals with interpretable temporal patterns [4]. While explainers designed for other modalities can be adapted to time series, their inherent biases can miss important structures in time series, and their reliance on isolated visual interpretability does not translate effectively to

the time series where data are less immediately interpretable. The dynamic nature and multi-scale dependencies within time series data require temporal interpretability techniques.

Research in model understanding and interpretability developed post-hoc explainers that treat pretrained models as black boxes and do not need access to internal model parameters, activations, and gradients. Recent research, however, shows that such post-hoc methods suffer from a lack of faithfulness and stability, among other issues [5, 6, 7]. A model can also be understood by investigating what parts of the input it attends to through attention mapping [8, 9, 10] and measuring the impact of modifying individual computational steps within a model [11, 12]. Another major line of inquiry investigates internal mechanisms by asking what information the model contains [13, 14, 15]. For example, it has been found that even when a language model is conditioned to output falsehoods, it may include a hidden state that represents the true answer internally [16]. The gap between external failure modes and internal states can only be identified by probing model internals. Such representation

Pretrainedmodel's

Input time series

TimeXlatent

space

Identifywhatsignals

themodelusesand

where they are

Identifylandmarks that explain

modelbehavior

probing has been used to characterize the behaviors of language models, but leveraging these strategies to understand time series models has yet to be attempted. These lines of inquiry drive the development of in-hoc explainers [17, 18, 19, 20, 21, 22] that build inherent interpretability into the model through architectural modifications [18, 19, 23, 20, 21] or regularization [17, 22]. However, no in-hoc explainers have been developed for time series data. While explainers designed for other modalities can be adapted to time series, their inherent biases do not translate effectively to the uninterpretable nature of time series data. They can miss important structures in time series.

Explaining time series models is challenging for many reasons. First, unlike imaging or text datasets, large time series data are not visually interpretable . Next, time series often exhibit dense informative features, unlike more explored modalities such as imaging, where informative features are often sparse. In time series datasets, timestep-to-timestep transitions can be negligible, and temporal patterns only show up when looking at time segments and long-term trends . In contrast, in language datasets, word-to-word transitions are informative for language modeling and understanding. Further, time series interpretability involves understanding the dynamics of the model and identifying trends or patterns. Another critical issue with applying prior methods is that they treat all time steps as separate features , ignoring potential time dependencies and contextual information; we need explanations that are temporally connected and visually digestible . While understanding predictions of individual samples is valuable, the ability to establish connections between explanations of various samples (for example, in an appropriate latent space) could help alleviate these challenges.

Present work. We present TIMEX, a novel time series surrogate explainer that produces interpretable attribution masks as explanations over time series inputs (Figure 1). 1 ⃝ A key contribution of TIMEX is the introduction of model behavior consistency, a novel formulation that ensures the preservation of relationships in the latent space induced by the pretrained model, as well as the latent space induced by TIMEX. 2 ⃝ In addition to achieving model behavior consistency, TIMEX offers interpretable attribution maps, which are valuable tools for interpreting the model's predictions, generated using discrete straight-through estimators (STEs), a type of gradient estimator that enables end-to-end training of TIMEX models. 3 ⃝ Unlike existing interpretability methods, TIMEX goes further by learning a latent space of explanations. By incorporating model behavior consistency and leveraging a latent space of explanations, TIMEX provides discrete attribution maps and enables visual aggregation of similar explanations and the recognition of temporal patterns. 4 ⃝ We test our approach on eight synthetic and real-world time series datasets, including datasets with carefully processed ground-truth explanations to quantitatively benchmark it and compare it to general explainers, state-of-the-art time series explainers, and in-hoc explainers. TIMEX is at https://github.com/mims-harvard/ TimeX

2 Related work

Model understanding and interpretability. As deep learning models grow in size and complexity, so does the need to help users understand the model's behavior. The vast majority of explainable AI research (XAI) [24] has focused on natural language processing (NLP) [25, 26, 27] and computer vision (CV) [28, 29, 30]. Commonly used techniques, such as Integrated Gradients [31] and Shapley Additive Explanations (SHAP) [3], and their variants have originated from these domains and gained popularity. XAI has gained significant interest in NLP and CV due to the inherent interpretability of the data. However, this familiarity can introduce confirmation bias [32]. Recent research has expanded to other data modalities, including graphs [33, 6] and time series [34, 35], as outlined below. The literature primarily focuses on post-hoc explainability, where explanations are provided for a trained and frozen model's behavior [36, 37]. However, saliency maps, a popular approach [38, 31, 39], have pitfalls when generated post-hoc : they are surprisingly fragile [5], and lack sensitivity to their explained models [40]. Surrogate-based approaches have also been proposed [41, 42, 43], but these simplified surrogate models fall short compared to the original predictor they aim to explain. Unlike post-hoc explainability, in-hoc methods aim for inherently interpretable models. This can be accomplished by modifying the model's architecture [20], training procedure using jointly-trained explainers [44], adversarial training [45, 46, 47, 48], regularization techniques [17, 22], or refactorization of the latent space [49, 50]. However, such models often struggle to achieve state-of-the-art predictive performance, and to date, these methods have seen limited use for time series.

Beyond instance-based explanations. Several methods have been proposed to provide users with information on model behavior beyond generating instance-based saliency maps explaining individual predictions. Prototype models strive to offer a representative sample or region in the latent space [51, 52]. Such methods are inherently interpretable, as predictions are directly tied to patterns in the feature space. Further, explainability through human-interpretable exemplars has been gaining popularity. Concept-based methods decompose model predictions into human-interpretable concepts . Many works rely on annotated datasets with hand-picked concepts ( e.g. , 'stripes' in an image of a zebra). Relying on access to a priori defined concepts, concept bottleneck models learn a layer that attributes each neuron to one concept [23]. This limitation has spurred research in concept discovery by composing existing concepts [53, 54] or grounding detected objects to natural language [55]. However, the CV focus of these approaches limits their applicability to other domains like time series.

Time series explainability. In contrast to other modalities, time series often have multiple variables, and their discriminative information is spread over many timesteps. Building on these challenges, recent works have begun exploring XAI for time series [56, 57, 58, 59, 60, 61, 34, 62]. Many methods modify saliency maps [35, 63, 58] or surrogate methods [59, 64] to work with time series data. Two representative methods are WinIT [65] and Dynamask [58]. WinIT learns saliency maps with temporal feature importances, while Dynamask regularizes saliency maps to include temporal smoothing. However, these methods rely on perturbing timesteps [63], causing them to lack faithfulness. Common perturbation choices in CV, like masking with zeros, make less sense for time series [56]. Perturbed time series may be out-of-distribution for the model due to shifts in shape [66], resulting in unfaithful explanations akin to adversarial perturbation [67].

3 Problem formulation

Notation. Given is a time series dataset D = ( X , Y ) = { ( x i , y i ) | i = 1 , ..., N } where x i are input samples and y i are labels associated to each sample. Each sample x i ∈ R T × d is said to have T time steps and d sensors. A feature is defined as a time-sensor pair, where the time t and sensor k for input x i is x i [ t, k ] . Without loss of generality, we consider univariate ( d = 1 ) and multivariate ( d > 1 ) settings. Each y i ∈ { 1 , 2 , ..., C } belongs to one of C classes. A classifier model consists of an encoder G and predictor F . The encoder G produces an embedding of input x i , i.e. , G ( x i ) = z i ∈ R d z , while the predictor produces some prediction from the embedding in the form of a logit, i.e. , F ( G ( x i )) = ˆ y i ∈ [0 , 1] C where argmax j ˆ y i [ j ] ∈ { 1 , ..., C } is the predicted label.

The latent space induced by G is defined as Z , e.g. , G : X → Z . We will refer to F ( G ( · )) as the reference model while G is the reference encoder and F is the reference predictor . An explanation is defined as a continuous map of the features that conveys the relative importance of each feature for the prediction. The explanation for sample x i is given as an attribution map E ( x i ) ∈ R T × d where for any times t 1 , t 2 and sensors k 1 , k 2 , E ( x i [ t 1 , k 1 ]) > E ( x i [ t 2 , k 2 ]) implies that x i [ t 1 , k 1 ] is a more

z

i

z

j

z

k

F

G

G E

F E

z

E

i

z

E

j

z

E

k

TimeX

Predictor Model

H E

x

i

x

j

x

k

STE

z

L

1

z

L

2

z

L

3

E

(

x

)

x

m

}

}

Latent Space of

Explanations

important feature for the task than x i [ t 2 , k 2 ] . Finally, we define an occlusion procedure whereby a function Ω generates an mask M x for a sample x from the explanation E ( x ) , e.g., Ω( E ( x )) = M x . This mask is applied to x to derive a masked version of the input x m through an operation ⊙ , e.g., M x ⊙ x = x m . When describing TIMEX, we generally refer to ⊙ as an element-wise multiplication.

3.1 Self-supervised model behavior consistency

TIMEX creates an inherently-interpretable surrogate model for pretrained time series models. The surrogate model produces explanations by optimizing two main objectives: interpretability and faithfulness to model behavior. First, TIMEX generates interpretable explanations via an attribution map E ( x i ) that identifies succinct, connected regions of input important for the prediction. To ensure faithfulness to the reference model, we introduce a novel objective for training TIMEX: model behavior consistency (MBC) . With MBC, a TIMEX model learns to mimic internal layers and predictions of the reference model, yielding a high-fidelity time series explainer. MBC is defined as:

Definition 3.1 (Model Behavior Consistency (MBC)) . Explanation E and explanation encoder G E are consistent with pretrained model G and predictor F on dataset D if the following is satisfied:

Consistent reference encoder: Relationship between z i = G ( x i ) and z j = G ( x j ) in the space of reference encoder is preserved by the explainer, z E i = G E ( x i m ) and z E j = G E ( x j m ) , where x i m = Ω( E ( x i )) ⊙ x i and x j m = Ω( E ( x j )) ⊙ x j , through distance functions on the reference encoder's and explainer's latent spaces D Z and D Z E , respectively, such that: D Z ( z i , z j ) ≃ D Z E ( z E i , z E j ) for samples x i , x j ∈ D .

Consistent reference predictor: Relationship between reference predictor ˆ y i = F ( z i ) and latent explanation predictor ˆ y E i = F E ( z E i ) is preserved, ˆ y i ≃ ˆ y E i for every sample x i ∈ D .

Our central formulation is defined as realizing the MBC between a reference model and an interpretable TIMEX model:

Problem statement 3.1 (TIMEX) . Given pretrained time series encoder G and predictor F that are trained on a time series dataset D , TIMEX provides explanations E ( x i ) for every sample x i ∈ D in the form of interpretable attribution maps. These explanations satisfy model behavior consistency through the latent space of explanations Z E generated by the explanation encoder G E .

TIMEX is designed to counter several challenges in interpreting time series models. First, TIMEX avoids the pitfall known as the occlusion problem [68]. Occlusion occurs when some features in an input x i are perturbed in an effort that the predictor forgets those features. Since it is well-known that occlusion can produce out-of-distribution samples [69], this can cause unpredictable shifts in the behavior of a fixed, pretrained model [70, 71, 72]. In contrast, TIMEX avoids directly masking input samples to G . TIMEX trains an interpretable surrogate G E to match the behavior of G . Second, MBC is designed to improve the faithfulness of TIMEX to G . By learning to mimic multiple states of F ( G ( · )) using the MBC objective, TIMEX learns highly-faithful explanations, unlike many post hoc explainers that provide no explicit optimization of faithfulness. Finally, TIMEX's explanations are driven by learning a latent explanation space, offering richer interpretability data.

4 TIMEX method

We now present TIMEX, an approach to train an interpretable surrogate model to provide explanations for a pretrained time series model. TIMEX learns explanations through a consistency learning objective where an explanation generator H E and explanation encoder G E are trained to match intermediate feature spaces and the predicted label space. We will break down TIMEX in the following sections by components: H E , the explanation generator, G E , the explanation encoder, and the training objective of G E ( H E ( · )) , followed by a discussion of practical considerations of TIMEX. An overview of TIMEX is depicted in Figure 2.

4.1 Explanation generation

Generating an explanation involves producing an explanation map E ( x ) where if E ( x [ t 1 , k 1 ]) > E ( x [ t 2 , k 2 ]) , then feature x [ t 1 , k 1 ] is considered as more important for the prediction than x [ t 2 , k 2 ] . Explanation generation is performed through an explanation generator H E : X → [0 , 1] T × d , where H E ( x ) = p . We learn p based on a procedure proposed by [50], but we adapt their procedure for time series. Intuitively, p parameterizes a Bernoulli at each time-sensor pair, and the mask M X is sampled from this Bernoulli distribution during training, i.e. , M X ∼ P p ( M X |X ) = ∏ t,k Bern ( p t,k ) . This parameterization is directly interpretable as attribution scores: a low p t,k means that time-sensor pair ( t, k ) has a low probability of being masked-in. Thus, p is also the explanation for x i , i.e. , E ( x ) = p .

The generation of p is regularized through a divergence with Bernoulli distributions Bern ( r ) , where r is a user-chosen hyperparameter. As in [50], denote the desired distribution of p as Q ( M X ) = ∏ ( t,k ) Bern ( r ) . Then the objective becomes:

The sampling of M X ∼ P p ( M X |X ) is performed via the Gumbel-Softmax trick [73, 74], which is a differentiable approximation of categorical sampling. Importantly, M X is stochastically generated, which, as discussed in [50, 75], regularizes the model to learn robust explanations.

To generate interpretable attribution masks, TIMEX optimizes for the connectedness of predicted distributions:

The generator of explanations H E learns directly on input time series samples X to return p . We build a transformer encoder-decoder structure for H E , using an autoregressive transformer decoder and a sigmoid activation to output probabilities for each time-sensor pair.

4.2 Explanation encoding

We now describe how to embed explanations with the explanation encoder G E . Intuitively, G E learns on the masked distribution of X , which can be denoted as X m . Motivated by the occlusion problem, we avoid directly applying the masks onto the pretrained, frozen G , as X m and X are fundamentally different distributions. Therefore, we copy the weights of G into G E and fine-tune G E on X m .

Discretizing attribution masks. When passing inputs to G E , it is important for the end-to-end optimization to completely ignore regions identified as unimportant by H E . Therefore, we use a straight-through estimator (STE) [73] to obtain a discrete mask M X ∈ { 0 , 1 } T × d . Introduced by [76], STEs utilize a surrogate function to approximate the gradient of a non-differentiable operation used in the forward pass, such as binary thresholding.

Applying masks to time series samples. We use two types of masking procedures: attention masking and direct-value masking. First, we employ differentiable attention masking through a multiplicative operation proposed by Nguyen et al. [77]. When attention masking does not apply, we use a direct-value masking procedure based on architecture choice or multivariate inputs. We approximate a baseline distribution: B X = ∏ t,k N ( µ tk , σ 2 tk ) , where µ tk and σ 2 tk are the mean and

variance over time-sensor pairs. Masking is then performed through a multiplicative replacement as: x i m = ( M X ⊙ x i ) + (1 -M X ) ⊙ b , where b ∼ B X .

Justification for discrete masking. It is essential that masks M X are discrete instead of continuous. Previous works have considered masking techniques [78, 49, 50] with continuous masks since applying such masks is differentiable with element-wise multiplication. However, continuous masking has a distinctly different interpretation: it uses a continuous deformation of the input towards a baseline value. While such an approach is reasonable for data modalities with discrete structures, such as sequences of tokens (as in [78, 49]) or nodes in graphs [50], such deformation may result in a change of the shape of time series data, which is known to be important for prediction [66]. As a toy example, consider an input time series x i where the predictive pattern is driven by feature x i [ t 1 , k 1 ] is larger than all other features. Suppose M X is continuous. In that case, it is possible that for a less important feature x i [ t 2 , k 2 ] , M X [ t 1 , k 1 ] < M X [ t 2 , k 2 ] while ( M X [ t 1 , k 1 ] ⊙ x i [ t 1 , k 1 ]) > ( M X [ t 2 , k 2 ] ⊙ x i [ t 2 , k 2 ]) , thereby preserving the predictive pattern. At the same time, the mask indicates that x i [ t 2 , k 2 ] is more important than x i [ t 1 , k 1 ] . If a surrogate model is trained on M X ⊙ x i , M X may violate the ordinality expected by an attribution map as defined in Section 3. Discrete masking alleviates this issue by forcing M X to be binary, removing the possibility of confounds created by continuous masking. Therefore, discrete masking is necessary when learning interpretable masks on continuous time series.

4.3 Model behavior consistency

The challenge lies in training G E ( H E ( · )) to faithfully represent F ( G ( · )) . We approach this by considering the latent spaces of G and G E . If G considers x i and x j to be similar in Z , we expect that a faithful G E would encode x i m and x j m similarly. However, directly aligning G and G E is not optimal due to potential differences in the geometry of the explanation embedding space compared to the full input latent space. To address this, we introduce model behavior consistency (MBC). This novel self-supervised objective trains the explainer model to mimic the behavior of the original model without strict alignment between the spaces. Denote the latent space induced by G and G E as Z and Z E , respectively. The MBC objective is thus defined as:

where D Z and D Z E are distance functions on the reference model's latent space and the explanation encoder's latent space, respectively, and N is the size of the minibatch, thereby making N 2 equal to the number of pairs on which L MBC is optimized. This objective encourages distances to be similar across both spaces, encouraging Z E to retain a similar local topology to Z without performing a direct alignment. This is closely related to cycle-consistency loss, specifically cross-modal cycleconsistency loss as [79]. We use cosine similarity for D Z and D Z E throughout experiments in this study, but any distance can be defined on each respective space.

In addition to MBC, we use a label consistency (LC) objective to optimize TIMEX. We train a predictor F E on Z E to output logits consistent with those output by F . We use a Jensen-Shannon Divergence ( D JS) between the logits of both predictors:

̸

Our total loss function on Z E can then be defined as a combination of losses: L Z E = L MBC + λ LC L LC. Consistency learning justification. MBC offers three critical benefits for explainability. 1 ⃝ MBC enables consistency optimization across two latent spaces Z and Z E without requiring that both x i and x i m be encoded by the same model, allowing the learning of E on a separate model F E ( G E ( · )) = F ( G ( · )) . This avoids the out-of-distribution problems induced by directly masking inputs to G . 2 ⃝ MBC comprehensively represents model behavior for explainer optimization. This is in contrast to perturbation explanations [38, 80, 58] which seek a label-preserving perturbation P on F ( G ( · )) where F ( G ( P ( x i ))) ≈ F ( G ( x i )) . By using G ( x i ) and F ( G ( x i )) to capture the behavior of the reference model, MBC's objective is richer than a simple label-preserving objective. 3 ⃝ While MBC is stronger than label matching alone, it is more flexible than direct alignment. An alignment objective, which enforces z i ≈ z E i , inhibits G E from learning important features of explanations not

represented in Z . The nuance and novelty of MBC are in learning a latent space that is faithful to model behavior while being flexible enough to encode rich relational structure about explanations that can be exploited to learn additional features such as landmark explanations. Further discussion of the utility of MBC is in Appendix B.

4.4 Learning explanation landmarks and training TIMEX models

Leveraging the latent space, TIMEX generates landmark explanations z L ∈ R d z . Such landmarks are desirable as they allow users to compare similar explanation patterns across samples used by the predictor. Landmarks are learned by a landmark consistency loss, and their optimization is detached from the gradients of the explanations so as not to harm explanation quality. Denote the landmark matrix as L ∈ R n L × d z where n L corresponds to the number of landmarks (a user-chosen value) and d z is the dimensionality of Z E . For each sample explanation embedding z E i , we use Gumbel-Softmax STE (GS) to stochastically match z E i to the nearest landmark in the embedding space. Denote the vector of similarities to each z E i as s ( z E i , L ) . Then the assimilation A is described as:

where sg denotes the stop-grad function. The objective for learning landmarks is then L MBC ( Z, A ( Z E ; L )) , optimizing the consistency between the assimilated prototypes and the reference model's latent space. Landmarks are initialized as a random sample of explanation embeddings from Z E and are updated via gradient descent. After learning landmarks, we can measure the quality of each landmark by the number of z E i embeddings closest to it in latent space. We filter out any landmarks not sufficiently close to any samples (described in Appendix B).

TIMEX training. The overall loss function for TIMEX has four components: L = L MBC + λ LC L LC + λ E ( L m + λ con L con ) , where λ LC , λ E , λ con ∈ R are weights for the label consistency loss, total explanation loss, and connective explanation loss, respectively. TIMEX can be optimized end-to-end, requiring little hyperparameter choices from the user. The user must also choose the r parameter for the explanation regularization. Explanation performance is stable across choices of r (as found in [50]), so we set r = 0 . 5 to remain consistent throughout experiments. A lower r value may be provided if the underlying predictive signal is sparse; this hyperparameter is analyzed in Appendix C.3. In total, TIMEX optimizes H E , G E , and F E .

5 Experimental setup

Datasets. We design four synthetic datasets with known ground-truth explanations: FreqShapes , SeqComb-UV , SeqComb-MV , and LowVar . Datasets are designed to capture diverse temporal dynamics in both univariate and multivariate settings. We employ four datasets from real-world time series classification tasks: ECG [81] - ECG arrhythmia detection; PAM [82] - human activity recognition; Epilepsy [83] - EEG seizure detection; and Boiler [84] - mechanical fault detection. We define ground-truth explanations for ECG as QRS intervals based on known regions of ECG signals where arrhythmias can be detected. The R, P, and T wave intervals are extracted following [85]. Dataset details are given in Appendix C.1 and C.4.

Baselines. We evaluate the method against five explainability baselines. As a general explainer, we use integrated gradients ( IG ) [31]; for recent time series-specific explainers, we use Dynamask [58], and WinIT [86]; for an explainer that uses contrastive learning, we use CoRTX [87]; and for an in-hoc explainer which has been demonstrated for time series, we use SGT + Grad [17].

Evaluation. We consider two approaches. Ground-truth explanations: Generated explanations are compared to ground-truth explanations, i.e. , known predictive signals in each input time series sample when interpreting a strong predictor, following established setups [6]. We use the area under precision (AUP) and area under recall (AUR) curves to evaluate the quality of explanations [58]. We also use the explanation AUPRC, which combines the results of AUP and AUR. For all metrics, higher values are better. Definitions of metrics are in Appendix C.4. Feature importance under occlusion: We occlude the bottom p -percentile of features as identified by the explainer and measure the change in prediction AUROC (Sec. 4.2). The most essential features a strong explainer identifies should retain prediction performance under occlusion when p is high. To control for potential misinterpretations, we include a random explainer reference. Our experiments use transformers [88] with time-based positional encoding. Hyperparameters and compute details are given in Appendix C.

6 Results

R1: Comparison to existing methods on synthetic and real-world datasets.

Synthetic datasets. We compare TIMEX to existing explainers based on how well they can identify essential signals in time series datasets. Tables 1-2 show results for univariate and multivariate datasets, respectively. Across univariate and multivariate settings, TIMEX is the best explainer on 10/12 (3 metrics in 4 datasets) with an average improvement in the explanation AUPRC (10.01%), AUP (6.01%), and AUR (3.35%) over the strongest baselines. Specifically, TIMEX improves groundtruth explanation in terms of AUP by 3.07% on FreqShapes, 6.3% on SeqComb-UV, 8.43% on SeqComb-MV, and 6.24% on LowVar over the strongest baseline on each dataset. In all of these settings, AUR is less critical than AUP since the predictive signals have redundant information. TIMEX achieves high AUR because it is optimized to output smooth masks over time, tending to include larger portions of entire subsequence patterns than sparse portions, which is relevant for human interpretation. To visualize this property, we show TIMEX's explanations in Appendix C.5.

Real-world datasets: arrhythmia detection. We demonstrate TIMEX on ECG arrhythmia detection. TIMEX's attribution maps show a state-of-the-art performance for finding relevant QRS intervals driving the arrhythmia diagnosis and outperform the strongest baseline by 5.39% (AUPRC) and 9.83% (AUR) (Table 3). Integrated gradients achieve a slightly higher AUP, whereas state-of-the-art time series explainers perform poorly. Notably, TIMEX's explanations are significantly better in AUR, identifying larger segments of the QRS interval rather than individual timesteps.

Ablation study on ECG data. We conduct ablations on the ECG data using TIMEX (Table 3). First, we show that the STE improves performance as opposed to soft attention masking, resulting in an AUPRC performance gain of 9.44%; this validates our claims about the pitfalls of soft masking for time series. Note that this drop in performance becomes more significant when including direct-value masking, as shown in Appendix C.6. Second, we use SimCLR loss to align Z E to Z as opposed to MBC; SimCLR loss can achieve comparable results in AUPRC and AUR, but the AUP is 13.6% lower than the base TIMEX. Third, we experiment with the usefulness of MBC and LC objectives. MBC alone produces poor explanations with AUPRC at 65.8% lower score than the base model. LC alone does better than MBC alone, but its AUPRC is still 21.5% lower than the base model. MBC and LC, in conjunction, produce high-quality explanations, showing the value in including more intermediate states for optimizing G E ( H E ( · )) . Extensive ablations are provided in Appendix C.6.

R2: Occlusion experiments on real-world datasets.

We evaluate TIMEX explanations by occluding important features from the reference model and observing changes in classification [63, 58, 87]. Given a generated explanation E ( x i ) , the bottom p -percentile of features are occluded; we expect that if the explainer identifies important features for the model's prediction, then the classification performance to drop significantly when replacing these important features (determined by the explainer) with baseline values. We compare the performance under occlusion to random explanations to counter misinterpretation (Sec. 3.1). We adopt the masking

(a)

Epilepsy

(b)

PAM

(c)

procedure described in Sec. 4.2, performing attention masking where applicable and direct-value masking otherwise.

Figure 3 compares TIMEX to Dynamask, a strong time-series explainer. On all datasets, TIMEX's explanations are either at or above the performance of Dynamask, and both methods perform above the random baseline. On the Boiler dataset, we demonstrate an average of 27.8% better classification AUROC across each threshold than Dynamask, with up to 37.4% better AUROC at the 0.75 threshold. This gap in performance between TIMEX and Dynamask is likely because the underlying predictor for Boiler is weaker than that of Epilepsy or PAM, achieving 0.834 AUROC compared to 0.979 for PAM and 0.939 for Epilepsy. We hypothesize that TIMEX outperforms Dynamask because it only considers changes in predicted labels under perturbation while TIMEX optimizes for consistency across both labels and embedding spaces in the surrogate and reference models. TIMEX performs well across both univariate (Epilepsy) and multivariate (PAM and Boiler) datasets.

R3: Landmark explanation analysis on ECG.

To demonstrate TIMEX's landmarks, we show how landmarks serve as summaries of diverse patterns in an ECG dataset. Figure 4 visualizes the learned landmarks in the latent space of explanations. We choose four representative landmarks based on the previously described landmark ranking strategy (Sec. 4.4). Every landmark occupies different regions of the latent space, capturing diverse types of explanations generated by the model. We show the three nearest explanations for the top two landmarks regarding the nearest neighbor in the latent space. Explanations 1 ⃝ , 2 ⃝ , and 3 ⃝ are all similar to each other while distinctly different from 4 ⃝ , 5 ⃝ , and 6 ⃝ , both in terms of attribution and temporal structure. This visualization shows how landmarks can partition the latent space of explanations into interpretable temporal patterns. We demonstrate the high quality of learned landmark explanations through a quantitative experiment in Appendix C.10.

Additional experiments demonstrating flexibility of TIMEX.

In the Appendix, we present several additional experiments to demonstrate the flexibility and superiority of TIMEX. In Appendix C.8, we replicate experiments on two other time series architectures, LSTM and CNN, and show that TIMEX retains state-of-the-art performance. In Appendix C.9, we demonstrate the performance of TIMEX in multiple task settings, including forecasting and irregularly-sampled time series classification. TIMEX can be adapted to these settings with minimal effort and retains excellent explanation performance.

7 Conclusion

We develop TIMEX, an interpretable surrogate model for interpreting time series models. By introducing the novel concept of model behavior consistency ( i.e. , preserving relations in the latent space induced by the pretrained model when compared to relations in the latent space induced by the explainer), we ensure that TIMEX mimics the behavior of a pretrained time series model, aligning

Latent Space of Explanations

6

5

4

1

3

2

influential time series signals with interpretable temporal patterns. The generation of attribution maps and utilizing a latent space of explanations distinguish TIMEX from existing methods. Results on synthetic and real-world datasets and case studies involving physiological time series demonstrate the superior performance of TIMEX compared to state-of-the-art interpretability methods. TIMEX's innovative components offer promising potential for training interpretable models that capture the behavior of pretrained time series models.

Limitations. While TIMEX is not limited to a specific task as an explainer, our experiments focus on time series classification. TIMEX can explain other downstream tasks, assuming we can access the latent pretrained space, meaning it could be used to examine general pretrained models for time series. Appendix C.9 gives experiments on various setups. However, the lack of such pretrained time series models and datasets with reliable ground-truth explanations restricted our testing in this area. One limitation of our approach is its parameter efficiency due to the separate optimization of the explanation-tuned model. However, we conduct a runtime efficiency test in Appendix C.7 that shows TIMEX has comparable runtimes to baseline explainers. Larger models may require adopting parameter-efficient tuning strategies.

Societal impacts. Time series data pervades critical domains including finance, healthcare, energy, and transportation. Enhancing the interpretability of neural networks within these areas has the potential to significantly strengthen decision-making processes and foster greater trust. While explainability plays a crucial role in uncovering systemic biases, thus paving the way for fairer and more inclusive systems, it is vital to approach these systems with caution. The risks of misinterpretations or an over-reliance on automated insights are real and substantial. This underscores the need for a robust framework that prioritizes human-centered evaluations and fosters collaboration between humans and algorithms, complete with feedback loops to continually refine and improve the system. This approach will ensure that the technology serves to augment human capabilities, ultimately leading to more informed and equitable decisions across various sectors of society.

References

Xiang Zhang, Ziyuan Zhao, Theodoros Tsiligkaridis, and Marinka Zitnik. Self-supervised contrastive pre-training for time series via time-frequency consistency. Advances in Neural

Information Processing Systems , 2022.

Pankaj Malhotra, Vishnu TV, Lovekesh Vig, Puneet Agarwal, and Gautam Shroff. TimeNet: pre-trained deep recurrent neural network for time series classification. arXiv:1706.08838 , 2017.

Scott M Lundberg and Su-In Lee. A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems , 30, 2017.

Ferdinand Küsters, Peter Schichtel, Sheraz Ahmed, and Andreas Dengel. Conceptual explanations of neural network prediction for time series. In 2020 International Joint Conference on Neural Networks (IJCNN) , pages 1-6, 2020.

Pieter-Jan Kindermans, Sara Hooker, Julius Adebayo, Maximilian Alber, Kristof T Schütt, Sven Dähne, Dumitru Erhan, and Been Kim. The (un) reliability of saliency methods. Explainable AI: Interpreting, explaining and visualizing deep learning , pages 267-280, 2019.

Chirag Agarwal, Owen Queen, Himabindu Lakkaraju, and Marinka Zitnik. Evaluating explainability for graph neural networks. Scientific Data , 10(1):144, 2023.

Chirag Agarwal, Marinka Zitnik, and Himabindu Lakkaraju. Probing gnn explainers: A rigorous theoretical and empirical analysis of gnn explanation methods. In International Conference on Artificial Intelligence and Statistics , pages 8969-8996. PMLR, 2022.

Jesse Vig. A multiscale visualization of attention in the transformer model. arXiv:1906.05714 , 2019.

Samira Abnar and Willem Zuidema. Quantifying attention flow in transformers. ACL , 2020.

Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, et al. In-context learning and induction heads. arXiv:2209.11895 , 2022.

Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in GPT. Advances in Neural Information Processing Systems , 35:17359-17372, 2022.

Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Yaron Singer, and Stuart Shieber. Investigating gender bias in language models using causal mediation analysis. Advances in Neural Information Processing Systems , 33:12388-12401, 2020.

Anna Rogers, Olga Kovaleva, and Anna Rumshisky. A primer in BERTology: What we know about how BERT works. Transactions of the Association for Computational Linguistics , 8:842-866, 2021.

Damai Dai, Li Dong, Yaru Hao, Zhifang Sui, Baobao Chang, and Furu Wei. Knowledge neurons in pretrained transformers. arXiv:2104.08696 , 2021.

Yonatan Belinkov. Probing classifiers: Promises, shortcomings, and advances. Computational Linguistics , 48(1):207-219, 2022.

Collin Burns, Haotian Ye, Dan Klein, and Jacob Steinhardt. Discovering latent knowledge in language models without supervision. arXiv:2212.03827 , 2022.

Aya Abdelsalam Ismail, Hector Corrada Bravo, and Soheil Feizi. Improving deep learning interpretability by saliency guided training. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems , 2021.

Pang Wei Koh, Thao Nguyen, Yew Siang Tang, Stephen Mussmann, Emma Pierson, Been Kim, and Percy Liang. Concept bottleneck models. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning , volume 119 of Proceedings of Machine Learning Research , pages 5338-5348. PMLR, 13-18 Jul 2020.

Rishabh Agarwal, Levi Melnick, Nicholas Frosst, Xuezhou Zhang, Ben Lengerich, Rich Caruana, and Geoffrey E Hinton. Neural additive models: Interpretable machine learning with neural nets. Advances in Neural Information Processing Systems , 34:4699-4711, 2021.

Bryan Lim, Sercan Ö Arık, Nicolas Loeff, and Tomas Pfister. Temporal fusion transformers for interpretable multi-horizon time series forecasting. International Journal of Forecasting , 37(4):1748-1764, 2021.

Boris N. Oreshkin, Dmitri Carpov, Nicolas Chapados, and Yoshua Bengio. N-beats: Neural basis expansion analysis for interpretable time series forecasting. ArXiv , abs/1905.10437, 2019.

Ryan Henderson, Djork-Arné Clevert, and Floriane Montanari. Improving molecular graph neural network explainability with orthonormalization and induced sparsity. In International Conference on Machine Learning , pages 4203-4213. PMLR, 2021.

Mert Yuksekgonul, Maggie Wang, and James Zou. Post-hoc concept bottleneck models. In International Conference on Learning Representations , 2023.

Finale Doshi-Velez and Been Kim. Towards a rigorous science of interpretable machine learning. arXiv preprint arXiv:1702.08608 , 2017.

Marina Danilevsky, Kun Qian, Ranit Aharonov, Yannis Katsis, Ban Kawas, and Prithviraj Sen. A survey of the state of explainable ai for natural language processing. arXiv preprint arXiv:2010.00711 , 2020.

Andreas Madsen, Siva Reddy, and Sarath Chandar. Post-hoc interpretability for neural nlp: A survey. ACM Computing Surveys , 55(8):1-42, 2022.

Francesco Bodria, Fosca Giannotti, Riccardo Guidotti, Francesca Naretto, Dino Pedreschi, and Salvatore Rinzivillo. Benchmarking and survey of explanation methods for black box models. arXiv preprint arXiv:2102.13076 , 2021.

Pantelis Linardatos, Vasilis Papastefanopoulos, and Sotiris Kotsiantis. Explainable ai: A review of machine learning interpretability methods. Entropy , 23(1):18, 2020.

Vitali Petsiuk, Abir Das, and Kate Saenko. Rise: Randomized input sampling for explanation of black-box models. In British Machine Vision Conference , 2018.

Wojciech Samek, Grégoire Montavon, Sebastian Lapuschkin, Christopher J Anders, and KlausRobert Müller. Explaining deep neural networks and beyond: A review of methods and applications. Proceedings of the IEEE , 109(3):247-278, 2021.

Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In International conference on machine learning , pages 3319-3328. PMLR, 2017.

Marzyeh Ghassemi, Luke Oakden-Rayner, and Andrew L Beam. The false hope of current approaches to explainable artificial intelligence in health care. The Lancet Digital Health , 3(11):e745-e750, 2021.

Zhitao Ying, Dylan Bourgeois, Jiaxuan You, Marinka Zitnik, and Jure Leskovec. Gnnexplainer: Generating explanations for graph neural networks. Advances in neural information processing systems , 32, 2019.

Udo Schlegel, Hiba Arnout, Mennatallah El-Assady, Daniela Oelke, and Daniel A Keim. Towards a rigorous evaluation of xai methods on time series. In 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW) , pages 4197-4201. IEEE, 2019.

Aya Abdelsalam Ismail, Mohamed Gunady, Hector Corrada Bravo, and Soheil Feizi. Benchmarking deep learning interpretability in time series predictions. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems , volume 33, pages 6441-6452. Curran Associates, Inc., 2020.

Himabindu Lakkaraju, Ece Kamar, Rich Caruana, and Jure Leskovec. Faithful and customizable explanations of black box models. In Proceedings of the 2019 AAAI/ACM Conference on AI, Ethics, and Society , pages 131-138, 2019.

Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Anchors: High-precision modelagnostic explanations. Proceedings of the AAAI conference on artificial intelligence , 32(1), 2018.

Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Computer Vision-ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part I 13 , pages 818-833. Springer, 2014.

Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE international conference on computer vision , pages 618-626, 2017.

Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt, and Been Kim. Sanity checks for saliency maps. Advances in neural information processing systems , 31, 2018.

Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 'why should i trust you?': Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining , page 1135-1144, San Francisco California USA, Aug 2016. ACM.

Scott M Lundberg, Gabriel Erion, Hugh Chen, Alex DeGrave, Jordan M Prutkin, Bala Nair, Ronit Katz, Jonathan Himmelfarb, Nisha Bansal, and Su-In Lee. From local explanations to global understanding with explainable ai for trees. Nature machine intelligence , 2(1):56-67, 2020.

Haoran Zhang, Quaid Morris, Berk Ustun, and Marzyeh Ghassemi. Learning optimal predictive checklists. Advances in Neural Information Processing Systems , 34:1215-1229, 2021.

Indro Spinelli, Simone Scardapane, and Aurelio Uncini. A meta-learning approach for training explainable graph neural networks. IEEE Transactions on Neural Networks and Learning Systems , page 1-9, 2022.

Theodoros Tsiligkaridis and Jay Roberts. Understanding and increasing efficiency of frankwolfe adversarial training. In CVPR , 2022.

Jay Roberts and Theodoros Tsiligkaridis. Controllably Sparse Perturbations of Robust Classifiers for Explaining Predictions and Probing Learned Concepts. In Daniel Archambault, Ian Nabney, and Jaakko Peltonen, editors, Machine Learning Methods in Visualisation for Big Data . The Eurographics Association, 2021.

Jay Roberts and Theodoros Tsiligkaridis. Ultrasound diagnosis of covid-19: Robustness and explainability. In Medical Imaging meets NeurIPS Workshop , 2020.

Ian E. Nielsen, Dimah Dera, Ravi P. Ramachandran Ghulam Rasool, and Nidhal Carla Bouay. Robust explainability: A tutorial on gradient-based attribution methods for deep neural networks. IEEE Signal Processing Magazine , 39(4), July 2022.

Jasmijn Bastings, Wilker Aziz, and Ivan Titov. Interpretable neural predictions with differentiable binary variables. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics , pages 2963-2977, Florence, Italy, July 2019. Association for Computational Linguistics.

Siqi Miao, Mia Liu, and Pan Li. Interpretable and generalizable graph learning via stochastic attention mechanism. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato, editors, Proceedings of the 39th International Conference on Machine Learning , volume 162 of Proceedings of Machine Learning Research , pages 15524-15543. PMLR, 17-23 Jul 2022.

Chaofan Chen, Oscar Li, Daniel Tao, Alina Barnett, Cynthia Rudin, and Jonathan K Su. This looks like that: deep learning for interpretable image recognition. Advances in neural information processing systems , 32, 2019.

Srishti Gautam, Ahcene Boubekki, Stine Hansen, Suaiba Salahuddin, Robert Jenssen, Marina Höhne, and Michael Kampffmeyer. Protovae: A trustworthy self-explainable prototypical variational model. Advances in Neural Information Processing Systems , 35:17940-17952, 2022.

Irina Higgins, Nicolas Sonnerat, Loic Matthey, Arka Pal, Christopher P Burgess, Matko Bosnjak, Murray Shanahan, Matthew Botvinick, Demis Hassabis, and Alexander Lerchner. Scan: Learning hierarchical compositional visual concepts. arXiv preprint arXiv:1707.03389 , 2017.

Tailin Wu, Megan Tjandrasuwita, Zhengxuan Wu, Xuelin Yang, Kevin Liu, Rok Sosic, and Jure Leskovec. Zeroc: A neuro-symbolic model for zero-shot concept recognition and acquisition at inference time. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems , 2022.

Jiayuan Mao, Chuang Gan, Pushmeet Kohli, Joshua B Tenenbaum, and Jiajun Wu. The neurosymbolic concept learner: Interpreting scenes, words, and sentences from natural supervision. International Conference on Learning Representations , 2019.

Prathyush S Parvatharaju, Ramesh Doddaiah, Thomas Hartvigsen, and Elke A Rundensteiner. Learning saliency maps to explain deep time series classifiers. In Proceedings of the 30th ACM International Conference on Information & Knowledge Management , pages 1406-1415, 2021.

Ramesh Doddaiah, Prathyush Parvatharaju, Elke Rundensteiner, and Thomas Hartvigsen. Classspecific explainability for deep time series classifiers. In Proceedings of the International Conference on Data Mining , 2022.

Jonathan Crabbé and Mihaela Van Der Schaar. Explaining time series predictions with dynamic masks. In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning , volume 139 of Proceedings of Machine Learning Research , pages 2166-2177. PMLR, 18-24 Jul 2021.

João Bento, Pedro Saleiro, André F. Cruz, Mário A. T. Figueiredo, and Pedro Bizarro. Timeshap: Explaining recurrent models through sequence perturbations. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining , page 2565-2573, Aug 2021. arXiv:2012.00073 [cs].

Riccardo Guidotti and et al. Explaining any time series classifier. International Conference on Cognitive Machine Intelligence , 2020.

F.and et al Mujkanovic. timexplain-a framework for explaining the predictions of time series classifiers. ArXiv , 2020.

Thomas Rojat, Raphaël Puget, David Filliat, Javier Del Ser, Rodolphe Gelin, and Natalia Díaz-Rodríguez. Explainable artificial intelligence (xai) on timeseries data: A survey. arXiv preprint arXiv:2104.00950 , 2021.

Sana Tonekaboni, Shalmali Joshi, Kieran Campbell, David K Duvenaud, and Anna Goldenberg. What went wrong and when? instance-wise feature importance for time-series black-box models. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems , volume 33, pages 799-809. Curran Associates, Inc., 2020.

Torty Sivill and Peter Flach. Limesegment: Meaningful, realistic time series explanations. In Proceedings of The 25th International Conference on Artificial Intelligence and Statistics , page 3418-3433. PMLR, May 2022.

Clayton Rooke, Jonathan Smith, Kin Kwan Leung, Maksims Volkovs, and Saba Zuberi. Temporal dependencies in feature importance for time series predictions. arXiv preprint arXiv:2107.14317 , 2021.

Lexiang Ye and Eamonn Keogh. Time series shapelets: a new primitive for data mining. In Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining , pages 947-956, 2009.

Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199 , 2013.

Q. Vera Liao and Kush R. Varshney. Human-centered explainable ai (xai): From algorithms to user experiences, 2022.

Mohammad Azizmalayeri, Arshia Soltani Moakar, Arman Zarei, Reihaneh Zohrabi, Mohammad Taghi Manzuri, and Mohammad Hossein Rohban. Your out-of-distribution detection method is not robust! In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems , 2022.

Peter Hase, Harry Xie, and Mohit Bansal. The out-of-distribution problem in explainability and search methods for feature importance explanations. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems , volume 34, pages 3650-3666. Curran Associates, Inc., 2021.

Cheng-Yu Hsieh, Chih-Kuan Yeh, Xuanqing Liu, Pradeep Kumar Ravikumar, Seungyeon Kim, Sanjiv Kumar, and Cho-Jui Hsieh. Evaluations and methods for explanation through robustness analysis. In International Conference on Learning Representations , 2021.

Luyu Qiu, Yi Yang, Caleb Chen Cao, Jing Liu, Yueyuan Zheng, Hilary Hei Ting Ngai, Janet Hsiao, and Lei Chen. Resisting out-of-distribution data problem in perturbation of xai. arXiv preprint arXiv:2107.14000 , 2021.

Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In International Conference on Learning Representations , 2017.

Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In International Conference on Learning Representations , 2017.

Siqi Miao, Yunan Luo, Mia Liu, and Pan Li. Interpretable geometric deep learning via learnable randomness injection. In The Eleventh International Conference on Learning Representations , 2023.

Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432 , 2013.

Thanh-Tung Nguyen, Xuan-Phi Nguyen, Shafiq Joty, and Xiaoli Li. Differentiable window for dynamic local attention. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics , pages 6589-6599, Online, July 2020. Association for Computational Linguistics.

Tao Lei, Regina Barzilay, and Tommi Jaakkola. Rationalizing neural predictions. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing , pages 107-117, Austin, Texas, November 2016. Association for Computational Linguistics.

Shashank Goel, Hritik Bansal, Sumit Bhatia, Ryan A. Rossi, Vishwa Vinay, and Aditya Grover. CyCLIP: Cyclic contrastive language-image pretraining. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems , 2022.

Ruth Fong, Mandela Patrick, and Andrea Vedaldi. Understanding deep networks via extremal perturbations and smooth masks. In Proceedings of the IEEE/CVF international conference on computer vision , pages 2950-2958, 2019.

George B. Moody and Roger G. Mark. The impact of the mit-bih arrhythmia database. IEEE Engineering in Medicine and Biology Magazine , 20:45-50, 2001.

Attila Reiss and Didier Stricker. Introducing a new benchmarked dataset for activity monitoring. In 2012 16th international symposium on wearable computers , pages 108-109. IEEE, 2012.

Ralph G Andrzejak, Klaus Lehnertz, Florian Mormann, Christoph Rieke, Peter David, and Christian E Elger. Indications of nonlinear deterministic and finite-dimensional structures in time series of brain electrical activity: Dependence on recording region and brain state. Physical Review E , 64(6):061907, 2001.

R. Shohet, M. Kandil, and J.J. McArthur. Simulated boiler data for fault detection and classification, 2019.

Dominique Makowski, Tam Pham, Zen J. Lau, Jan C. Brammer, François Lespinasse, Hung Pham, Christopher Schölzel, and S. H. Annabel Chen. NeuroKit2: A python toolbox for neurophysiological signal processing. Behavior Research Methods , 53(4):1689-1696, feb 2021.

Kin Kwan Leung, Clayton Rooke, Jonathan Smith, Saba Zuberi, and Maksims Volkovs. Temporal dependencies in feature importance for time series prediction. In The Eleventh International Conference on Learning Representations , 2023.

Yu-Neng Chuang, Guanchu Wang, Fan Yang, Quan Zhou, Pushkar Tripathi, Xuanting Cai, and Xia Hu. Cortx: Contrastive framework for real-time explanation. ArXiv , abs/2303.02794, 2023.

Ashish Vaswani, Noam M. Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS , 2017.

Appendix A Further discussion of background

Straight-through estimators. Discrete operations, such as thresholding, are often avoided in neural network architectures due to difficulties differentiating discrete functions. To circumvent these issues, [76] introduces the straight-through estimator (STE), which uses a surrogate function during backpropagation to approximate the gradient for a non-differentiable operation. STEs have seen usage in quantized neural networks [S1]. This method shows empirical performance even though there is little theoretical justification behind it [S2].

Self-supervised learning. Methods in self-supervised learning (SSL) have become a common pretraining technique for settings in which large, unlabeled datasets are available [S3, S4, S5, S6]. Common approaches for self-supervised learning are contrastive learning, which seeks to learn representations for samples under invariant data augmentations, and metric learning, which aims to generate a latent space in which a distance function captures some pre-defined relations on data [S7]. Consistency learning has emerged as another promising SSL approach; intuitively, this family of methods seeks to learn latent spaces in which similar pairs are expected to be embedded similarly, i.e. , preserving some consistent properties. Consistency learning has seen use in aligning videos [S8], enhancing latent geometry for multimodal contrastive learning [79], and pretraining time series models across time and frequency domains [1].

The use of consistency for explaining machine learning models. Consistency has been considered in previous XAI literature in two ways: 1) consistency between explanations and 2) consistency as an explainability metric, as explained below.

Consistency between explanations : This notion has been introduced in previous works in explainability literature. Pillai et al. [S9] train a saliency explainer via contrastive learning that preserves consistency across the saliency maps for augmented versions of images. A few other works have explored maintaining consistency of explanations across various perturbations and augmentations, specifically in computer vision [S10, S11]. In one of the only previous works to consider explanation consistency in time series, Watson et al. [S12] train an explainer on an ensemble of classifiers to optimize the consistency of explanations generated by an explainer applied to each classifier. TIMEX does not seek to optimize consistency between explanations but rather a consistency to the predictor model on which it is explaining.

Consistency as an explainability metric : Dasgupta et al. [S13] defines explanation consistency as similar explanations corresponding to similar predictions; this metric is then used as a proxy to faithfulness to evaluate the quality of explainers. However, Dasgupta et al. use consistency to evaluate explainers, not to train and design a new explainer method. TIMEX uses consistency as a learning objective rather than simply a metric.

Our work differs from these previous formulations of explanation consistency. We seek to optimize the consistency not between explanations directly, as mentioned in previous works, but rather between the explainer and the model it is tasked with explaining. MBC attempts to ensure that the behavior of the explainable surrogate matches that of the original model. The definition of consistency in Dasgupta et al. is the closest to our definition of MBC; however, Dasgupta et al. seek not to optimize the consistency of explainers but rrather to evaluate the output of post-hoc explainers. TIMEX directly optimizes the consistency between the surrogate model and the original predictor through the MBC loss, a novel formulation that seeks to increase the faithfulness of explanations generated by TIMEX.

Appendix B Further theoretical discussions

B.1 Differentiable attention masking

As is described in Section 4.1, we use differentiable attention masking [77], which is defined as such:

where Q , K , V represent query, key and values operators, d k is used as a normalization factor, and M X is a mask with self-attention values. This procedure is fully differentiable, and given that M X is binarized via the STE, it sets all attention values to zero that are to be ignored based on output from H E .

B.2 Further discussion on the utility of model behavior consistency

The model behavior consistency (MBC) framework in TIMEX is a method to train an interpretable surrogate model G E . In Section 4.3, we discuss the conceptual advances of this approach. Here, we will outline another advantage of the approach-preserving classification performance-and a brief discussion on the broader uses of MBC in other domains and applications.

Training a model with an interpretability bottleneck such as TIMEX is often challenging, as the inherent interpretability mechanism can hinder the performance and expressiveness of the method; this is an advantage of post-hoc methods. MBC allows one to preserve the performance of the underlying predictor. TIMEX, a surrogate method, allows one to keep the predictions from a pretrained time series encoder and develop explanations on top of it, which is practical for real-world use when a drop in classification performance is highly undesirable.

MBC is not limited to time series classification tasks. We demonstrate the utility of MBC for time series due to the particularly challenging nature of the data modality and the lack of available time series explainers. However, MBC gives a general framework for learning interpretable surrogate models through learning the H E and G E modules. MBC also has the potential to be applied to tasks outside of classification; since MBC is defined on the embedding space, any model with such an embedding space could be matched through a surrogate model as in TIMEX. This opens the possibility of learning on general pretrained models or even more complex tasks such as forecasting (as shown in Appendix C.9). Finally, we see MBC as having potential beyond explainability as well; one could imagine MBC being a way to distill knowledge into smaller models [S14, S15, S16]. We leave these discussions and experiments for future work.

B.3 Explanation landmark selection strategy

We proceed to describe how landmarks are selected for final interpretation. As described in Section 4.4, landmarks are initialized with the embeddings given by G for a random number of training samples. Practically, we stratify this selection across classes in the training set. Landmarks are then updated during the learning procedure. After learning landmarks, not every landmark will be helpful as an explanation; thus, we perform a filtration procedure. Intuitively, this filtration consists of detecting landmarks for which the landmark is the nearest landmark neighbor for many samples. This procedure is described in Algorithm 1.

Algorithm 1: Landmark filtration

Appendix C Additional experiments and experimental details

C.1 Description of datasets

We conduct experiments using both synthetic and real-world datasets. This section describes each synthetic and real-world dataset, including how ground-truth explanations are generated when applicable.

C.1.1 Synthetic datasets

We employ synthetic datasets with known ground-truth explanations to study the capability to identify the underlying predictive signal. We follow standard practices for designing synthetic datasets, including tasks that are predictive and not susceptible to shortcut learning [S17] induced by logical shortcuts. These principles are defined in [S18] concerning graphs, but we extend these to synthetic datasets for time series. Each time series is initialized with a non-autoregressive moving average (NARMA) noise base, and then the described patterns are inserted. We will briefly describe the construction of each time series dataset in this section, and the codebase contains full details at https://github.com/mims-harvard/TimeX . We designed four synthetic datasets to test different time series dynamics:

FreqShapes. Predictive signal is determined by the frequency of occurrence of an anomaly signal. To construct the dataset, take two upward and downward spike shapes and two frequencies, 10 and 17 time steps. There are four classes, each with a different combination of the attributes: class 0 has a downward spike occurring every 10-time steps, class 1 has an upward spike occurring every 10-time steps, class 2 has a downward spike occurring every 17-time steps, and class 3 has an upward spike occurring every 17-time steps. Ground-truth explanations are the locations of the upward and downward spikes.

SeqComb-UV. Predictive signal is defined by the presence of two shapes of subsequences: increasing (I) and decreasing (D) trends. First, two subsequence regions are chosen within the time series so neither subsequence overlaps; each subsequence is 10-20 time steps long. Then, a pattern is inserted based on the class identity; the increasing or decreasing trend is created with a sinusoidal noise with a randomly-chosen wavelength. Class 0 is null, following a strategy in [S18] that recommends using null classes for simple logical identification tasks in synthetic datasets. Class 1 is I, I; class 2 is D, D; and class 3 is I, D. Thus, the model is tasked with identifying both subsequences to classify each sample. Ground-truth explanations are the I and D sequences determining class labels.

SeqComb-MV. This dataset is a multivariate version of SeqComb-UV . The construction and class structure are equivalent, but the I and D subsequences are distributed across different sensors in the input. Upon constructing the samples, the subsequences are chosen to be on random sensors throughout the input. Ground-truth explanations are given as the predictive subsequences on their respective sensors, i.e. , the explainer is required to identify the time points at which the causal signal occurs and the sensors upon which they occur.

LowVar. Predictive signal is defined by regions of low variance over time that occur in a multivariate time series sample. Similar to SeqComb datasets, we choose a random subsequence in the input and, in that subsequence, replace the NARMA background sequence with Gaussian noise at a low variance. The subsequence is further discriminated by the mean of the Gaussian noise and the sensor on which the low variance sequence occurs. For class 0, the subsequence is at mean -1.5 on sensor 0; for class 1, the subsequence is at mean 1.5 on sensor 0; for class 2, the subsequence is at mean -1.5 on sensor 1; for class 3, the subsequence is at mean 1.5 on sensor 1. This task is distinctly different from other synthetic datasets, requiring recognition of a subsequence that is not anomalous from the rest of the sequence. This presents a more challenging explanation task; a simple change-point detection algorithm could not determine the explanation for this dataset.

We create 5,000 training samples, 1,000 testing samples, and 100 validation samples for each dataset. A summary of the dimensions of each dataset can be found in Table 4.

C.1.2 Real-world datasets

We employ four datasets from real-world time series classification tasks: PAM [82] - human activity recognition; ECG [81] - ECG arrhythmia detection; Epilepsy [83] - EEG seizure detection; and Boiler [84] - automatic fault detection.

PAM [82]. It measures the daily living activities of 9 subjects with three inertial measurement units. We excluded the ninth subject due to the short length of sensor readouts. We segment the continuous signals into samples with a time window of 600 and the overlapping rate of 50%. PAM initially has 18 activities of daily life. We exclude the ones associated with fewer than 500 samples, leaving us with eight activities. After modification, the PAM dataset contains 5,333 segments (samples) of sensory signals. Each sample is measured by 17 sensors and contains 600 continuous observations with a sampling frequency of 100 Hz. PAM is labeled into eight classes, where each class represents an activity of daily living. PAM does not include static attributes, and the samples are approximately balanced across all eight classes.

MIT-BIH (ECG) [81]. The MIT-BIH dataset has ECG recordings from 47 subjects recorded at the sampling rate of 360Hz. The raw dataset was then window-sliced into 92511 samples of 360 timestamps each. Two cardiologists have labeled each beat independently. Of the available annotations, we choose to use three for classification: normal reading (N), left bundle branch block beat (L), and right bundle branch block beat (R). We choose these because L and R diagnoses are known to rely on the QRS interval [S19, S20], which will then become our ground-truth explanation (see Section C.4). The Arrhythmia classification problem involves classifying each fragment of ECG recordings into different beat categories.

Epilepsy [83]. The dataset contains single-channel EEG measurements from 500 subjects. For every subject, the brain activity was recorded for 23.6 seconds. The dataset was then divided and shuffled (to mitigate sample-subject association) into 11,500 samples of 1 second each, sampled at 178 Hz. The raw dataset features five classification labels corresponding to different states of subjects or measurement locations - eyes open, eyes closed, EEG measured in the healthy brain region, EEG measured in the tumor region, and whether the subject has a seizure episode. To emphasize the distinction between positive and negative samples, we merge the first four classes into one, and each time series sample has a binary label indicating whether an individual is experiencing a seizure. There are 11,500 EEG samples in total.

Boiler [84]. This dataset consists of simulations of hot water heating boilers undergoing different mechanical faults. Various mechanical sensors are recorded over time to derive a time series dataset. The learning task is to detect the mechanical fault of the blowdown valve of each boiler. The dataset is particularly challenging because it includes a large dimension-to-length ratio, unlike the other datasets, which contain many more time steps than sensors (Table 5).

C.2 Descriptions of baseline methods

We now describe each baseline method in further detail.

IG [31]. Integrated gradients is a classical attribution method that utilizes the gradients of the model to form an explanation. The method compares the gradients to a baseline value and performs Riemannian integration to derive the explanation. Integrated gradients is a popular data-type agnostic interpretability method [S21], but it has no inductive biases specific for time series. We use the Captum [S22] implementation of this method, including default hyperparameters such as the baseline value.

Dynamask [58]. This explainer is built specifically for time series and uses a perturbation-based procedure to generate explanations. The method performs iterative occlusion of various input portions, learning a mask that deforms the input time series towards a carefully-determined baseline value.

This method is different from TIMEX in a few key ways. First, it performs continuous masking; TIMEX performs discrete masking through STEs. Second, it measures perturbation impact on the original model F ( G ( · )) ; TIMEX trains a surrogate model G E to learn the explanations and measure the impact of masking the input. Third, Dynamask learns the explanations iteratively for each sample; TIMEX trains the surrogate, which can then output explanations in one forward pass of H E .

WinIT [86]. This explainer is a feature removal explainer, similar to Dynamask. WinIT measures the impact of removing features from a time series on the final prediction value. It eliminates the impact of specific time intervals and learns feature dependencies across time steps. WinIT uses a generative model to perform in-distribution replacement of masked-out features. WinIT improves on a previous time series explainer, FIT [63], which is a popular baseline in time series explainability literature but is excluded in our work because WinIT is more recent and improves on FIT both conceptually and empirically.

CoRTX[87]. Contrastive real-time explainer (CoRTX) is an explainer method that utilizes contrastive learning to approximate SHAP [3] values. This method is developed for computer vision, but we implement a custom version that works with time series encoders and explanation generators. We include this method because it uses self-supervised learning to learn explanations. TIMEX also uses a self-supervised objective to learn explanations, but our method differs from CoRTX in several ways. First, CoRTX performs augmentation-based contrastive learning while we use MBC, which avoids the definition of negatives or the careful choice of augmentations specific to the data modality. Second, CoRTX fundamentally attempts to approximate SHAP values via a small number of SHAP explanations. In contrast, TIMEX includes a masking system that can produce masks without finetuning a model on a set of explanations derived from an external method. CorRTX parallels ours in using self-supervised learning but is fundamentally different from TIMEX.

SGT + Grad [17]. Saliency-guided training (SGT), an in-hoc explainer, is based on a modification to the training procedure. During training, features with low gradients are masked to steer the model to focus on more important regions for the prediction. The method is not an explainer alone but requires another post-hoc explainer to derive explanations. In our experiments, we consider saliency explanations, which the SGT authors recommend. The authors found that this method can improve performance on time series data. For this reason, we include it as one of our baselines to demonstrate the effectiveness of TIMEX against modern in-hoc explainers.

C.3 Hyperparameter selection

We list hyperparameters for each experiment performed in this work. For the ground-truth attribution experiments (Section 6, results R1 ), the hyperparameters are listed in Table 6. The hyperparameters used for the occlusion experiment (Section 6, results R2 ) with real-world datasets are in Table 7. We also list the architecture hyperparameters for the predictors trained on each dataset in Tables 8-9.

A few abbreviations are used for hyperparameters that are not mentioned in the main text. "Weight decay" refers to an L1 regularization on the model weights; the value for weight decay is equivalent to the weight on that term in the loss function compared to the rest of the loss terms (Section 4.4). "Scheduler?" refers to using a learning rate scheduler that decreases the learning rate by a factor of 10 if a plateau occurs. We use a scheduler that delays decreasing learning rates until after 20 epochs; not every experiment utilizes the scheduler as it is based on which choice yields lower validation loss upon convergence. "Distance norm." refers to a normalization of the distances in L MBC; the loss is divided by the variance of the distances on the Z embedding space. τ is the temperature parameter used for the Gumbel-Softmax reparameterization [73], Section 4.1. d h refers to the dimensionality of hidden layers in the transformer predictor. Finally, "Norm. embedding" refers to an architecture choice that normalizes Z when training the predictor; this is used to prevent a poor latent space when a collapse is observed via poor latent space geometry.

A few other notes on implementation and design of TIMEX: The architecture of H E uses the same size of G E and encoder for H E as for the predictor on each task. The number of transformer decoder layers is fixed at 2. Please reference the codebase for more details on these hyperparameters and implementations https://github.com/mims-harvard/TimeX .

Choosing the r parameter. One of the most significant parameters in training TIMEX is r , the parameter which controls sparsity of the learned masks. We conduct an experiment where we vary the parameters and measure explanation quality. We use the SeqComb-UV dataset and hold all hyperparameters constant while varying the parameter. The result is visualized in Figure 5. Low

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

r

0.3

0.4

0.5

0.6

0.7

0.8

0.9

AUPRC

AUP

AUR

values lead to a drop in explainer performance with respect to AUPRC and AUP. Importantly, for values above 0.4, the explainer performance is stable, suggesting that is robust to choice of value. Thus, we recommend choosing a value near 0.5 for experiments, as we did throughout our experiments. If the pattern is hypothesized to be sparse, one can set the value lower, and vice versa if the pattern is hypothesized to be dense.

C.4 Evaluation details

Following [58], we use AUP and AUR to evaluate the goodness of identification of salient attributes as a binary classification task, which is defined in C.1:

Definition C.1 (AUP,AUR [58]) . Let Q be a matrix in { 0 , 1 } T × d X whose elements indicate the true saliency of the inputs contained in x ∈ R T × d X . By definition, Q t,i = 1 if the feature x t,i is salient

and 0 otherwise. Let M be a mask in { 0 , 1 } T × d X obtained with a saliency method. Let τ ∈ (0 , 1) be the detection threshold for M t,i to indicate that the feature x t,i is salient. This allows to convert the mask into an estimator ˆ Q t,i ( τ ) via:

By considering the sets of truly salient indexes and the set of indexes selected by the saliency method:

the precision and recall curves that map each threshold to a precision and recall score:

The AUP and AUR scores are the area under these curves:

Groud-truth explanations for ECG datasets. We extract ground-truth explanations via a QRS detection strategy following [85] because an initial set of beat labels was produced by a simple slopesensitive QRS detector and were then given to two cardiologists, who worked on them independently. The cardiologists added additional beat labels where the detector missed beats, deleted false detections as necessary, and changed the labels for all abnormal beats. We employ Neurokit 1 to extract QRS complexes and also take care to ensure that the QRS is the proper explanation for each class. We consider two types of arrhythmias: left bundle branch block beat and right bundle branch block beat, to categorize our "abnormal" class. We perform the ground-truth evaluation on only the abnormal

Table 11: Ablation 1: Ablation using the STE vs. no STE. "No STE" is equivalent to continuous masking, as discussed in Section 4.2.

class, as the normal class signifies negative information, which may be harder to pinpoint based on model logic.

Statistical analysis. We evaluate each experiment on a 5-fold cross-validation of each dataset. We then report average performance and standard error across all folds of evaluation for each experiment, which results in the error bars seen in all tables throughout this work.

Evaluation with IoU metric. To further demonstrate the superior performance of TIMEX and the soundness of our evaluation setup, we additionally use an Intersection over Union (IoU) metric to measure the quality of explanations produced by baseline explainers compared to that of TIMEX when compared to ground-truth explanations. We calculate the IoU score on the SeqComb-UV dataset, as shown in Table 10. For comparison to our metrics, we include the AUPRC results for the same methods. The IoU metric is highly correlated with the AUPRC metric, with each metric resulting in the same ranking of methods and TIMEX achieving the highest metric.

C.5 Visualization of explanations

Figure 6 shows an example of TIMEX explainer versus IG and Dynamask. Shown is the SeqCombUV dataset, which has increasing and decreasing subsequences that determine the class label. Each explainer identifies the regions driving the prediction. IG identifies very sparse portions of the predictive region, choosing only one point out of the sequences for the explanation; this is not reasonable when scaling to large and noisier datasets where the signal might not be as clear. Dynamask seems to miss some important subsequences, identifying one or two subsequences. In contrast, TIMEX identifies a larger portion of the important subsequences due to the connection loss in Equation 2. This property becomes crucial when scaling to time series datasets with more noise as it becomes more difficult to intuitively deduce the causal signal through visual inspection.

C.6 Further ablation experiments

We present a more in-depth study of ablations on TIMEX on three datasets: FreqShapes (univariate), SeqComb-MV (multivariate), and ECG (real-world). This is an extension to the ablations on the ECG dataset in Section 6, R1 in Table 3.

Ablation 1: No STE. We now conduct an experiment examining the effectiveness of using the STE for training TIMEX. Table 11 shows the results of this ablation experiment. Using the STE provides over a 17% increase in AUPRC for attribution identification for every dataset. Furthermore, AUR is better when using an STE for every dataset, but the AUP is better for SeqComb-MV without the STE than with the STE. Using the STE also shows benefits in both the univariate (FreqShapes, ECG) and multivariate (SeqComb-MV) settings. In conclusion, the STE provides a noticeable benefit over a continuous masking approach, giving empirical evidence for the claims made in Section 4.2.

Ablation 2: SimCLR vs. MBC. We now test a classical SimCLR [S5] contrastive learning loss against our proposed model behavior consistency (MBC). The SimCLR objective is designed to decrease the distance between explanation embeddings and embeddings in the reference model's latent space. We do not perform data augmentations as in the original SimCLR work. The SimCLR loss that we use is given as:

Ground Truth

Integrated

Gradients

Dynamask

TimeX

1.0

0.8

h

0.6

0.4

0.2

0.0

1.0

0.8

0.6

0.4

0.2

0.0

1.0

0.8

0.6

0.4

0.2

0.0

m

h

2

1

0

-1

2.5

2.0

1.5

1.0

0.5

0.0

-0.5

5

4

m

2

0

-1

1.0

0.8

h

0.6

0.4

0.2

0.0

1.0

0.8

0.6

0.4

0.2

0.8

0.6

0.4

0.2

0.9

0.8

0.7

0.6

0.9

0.8

0.7

0.6

0.9

0.8

0.7

0.6

̸

For each SimCLR trial, we fixed the number of sampled negatives at 32 and kept all other parameters equal. In addition, an early stopping strategy was performed where the stopping value was based on cosine similarity between explanation embeddings and reference sample embeddings (higher similarity is better).

SimCLR loss provides a valuable objective for training TIMEX relative to baseline explainers, but MBC optimization produces more robust explanations. SimCLR delivers a slightly better AUPRC for ECG, but its AUPRC values are below that of MBC for FreqShapes and SeqComb-MV. SimCLR loss yields explanations with consistently lower AUP; AUP is closest for SeqComb-MV with only

a 3.4% drop from MBC, but it is at a 17.0% decline for FreqShapes and a 13.6% drop for ECG. It is important to note that in addition to increased performance, MBC loss is more computationally efficient than SimCLR loss, avoiding inference on negative samples.

Ablation 3: Effect of MBC and LC losses. We now examine the effectiveness of using both model behavior consistency (Eq. 3) (MBC) and label consistency (Eq. 4) (LC) losses. Table 13 shows that using LC and MBC in combination is always better than using either alone. In isolation, LC performs better than MBC, which is expected given its (obviously) higher correlation with the classification predictions than MBC, which relies on an earlier layer's embedding space. Using both losses results in a powerful explainer that achieves over 27.5% higher AUPRC than MBC or LC alone. MBC and LC work together to capture rich information about the model's behavior, allowing TIMEX to be a state-of-the-art explainer.

To justify these results, we recall an argument presented in Section 4.3, where we justify MBC. We remark that perturbation-based methods have a similar idea to TIMEX: find some sparse perturbation to the input that can preserve the output state of the model. This is often done by observing the predicted label from the model under an applied mask or perturbation, e.g., in one of our baselines, Dynamask. A perturbation that preserves the output state is said to be 'faithful' to the model because it is assumed that the model is invariant to the perturbation. In a sense, MBC generalizes this idea to latent spaces, ensuring that invariances are preserved in the latent space of the model as well as the prediction space.

Beyond the introduction of MBC alone, another core contribution of our work focuses on optimizing faithfulness to predictor models on multiple levels. We use multiple hidden or output states of the model, e.g., a latent and logit space, on which the explainable surrogate should match the reference predictor. The hypothesis behind this innovation is that model behavior (the exact objective we are trying to explain) cannot be fully captured by one state, e.g., a predicted label, but rather by multiple states throughout the model. A similar assumption is made in knowledge distillation, where methods often optimize student models to match the teacher in various network layers. Therefore, MBC and LA together enforce adherence to model behavior on two fronts: the latent space and prediction space, respectively. This explains the observed behavior: MBC and LA perform poorly alone, but together, these two losses provide a powerful objective to train the model.

C.7 Implementation and computing resources

Implementation. We implemented all methods in this study using Python 3.8+ and PyTorch 2.0. In our experiments, we employed the Vanilla Transformer [88] as the classification model for all methods. We verified that the classification models achieved satisfactory performance on the testing set to ensure that the models are strong predictors, which was previously pointed out by Faber et al.

[S18] as necessary for explainability evaluation. Complete classification results are in Table 15. We followed the hyperparameters recommended by the respective authors for all baseline methods.

Computational resources. For computational resources, we use a GPU cluster with various GPUs, ranging from 32GB Tesla V100s GPU to 48GB RTX8000 GPU. TIMEX and all models were only trained on a single GPU at any given time. The average experiment runtime in this work was around 5 minutes per fold, with ECG taking the longest at approximately 13 minutes per fold when training TIMEX to convergence.

Runtime experiment. We conducted a runtime experiment to understand how TIMEX compares to baseline explainers. Table X shows the training and inference time in seconds of TIMEX versus two state-of-the-art time series-specific baselines, Dynamask and WinIT. We chose two real-world time series datasets, PAM and Epilepsy, which are of varying sizes. PAM contains 4266 training samples and 534 testing samples, each of 600 time steps in length. Epilepsy contains 8280 training samples and 2300 testing samples, each of 178 time steps in length. Table 14 shows the time in seconds needed to train each explainer and to perform inference on the testing set.

TIMEX is the most efficient model at inference time for both datasets. This result is expected, as Dynamask and WinIT both require iterative procedures for each sample at inference time, while TIMEX requires only a forward pass at inference. Combining training and inference time, TIMEX is the second-fastest on both datasets. However, WinIT and Dynamask times vary greatly between each dataset, with Dynamask being the fastest on PAM and WinIT being the fastest on Epilepsy. WinIT scales poorly to samples with many time steps, while Dynamask scales poorly to large testing sets. TIMEX strikes a compromise between these extremes, scaling better than Dynamask to larger testing sets while scaling better than WinIT to longer time series.

C.8 Flexible use of TIMEX with different time series architectures

We now study the ability of TIMEX to work with different underlying time series architectures. This means that of the original architecture, G and G E are now an alternative architecture, while H E remains as described in Section 4.1. Since experiments in the main text are based on transformer architectures, we now use a convolutional neural network (CNN) and long-short term memory (LSTM) network as the underlying predictors with the following hyperparameters:

LSTM: 3 layer bidirectional LSTM + MLP on mean of last hidden states

CNN: 3 layer CNN + MLP on meanpool

Tables 18 19 show the results of TIMEX against strong baselines with a CNN predictor. TIMEX retains the state-of-the-art prediction observed for the transformer-based architecture, achieving

the best AUPRC on SeqComb-MV and ECG datasets. However, the performance for FreqShapes saturates at very high values for both TIMEX and IG, making the comparison more difficult for AUPRC. Tables 16,17 show the results of TIMEX against strong baselines with an LSTM predictor. TIMEX performs very well for both FreqShapes and ECG datasets, achieving the highest AUPRC, AUP, and AUR for both datasets. For SeqComb-MV, TIMEX did not converge. However, no explainer performed well for this task, achieving lower results than for the transformer and CNN predictors.

Visualization under different architectures. We add a visualization on the FreqShapes dataset with various explainers on different underlying architectures. Figure 7 shows this visualization. Explanations are similar across models. IG outputs appear similar, but TIMEX has a higher recall for essential patterns, which is reflected in quantitative results.

C.9 TIMEX on diverse tasks and datasets

We experiment with TIMEX on various tasks and types of datasets to demonstrate the generality of the method.

Irregular time series. We experiment with TIMEX on irregular time series classification. We introduce an irregularly sampled version of SeqComb-MV, randomly dropping an average of 15% of time steps. This results in variable-length time series, addressing both W1 and W2. We then follow Zhang et al. [S23], using a time series transformer with an irregular attention mask. We train only with direct-value masking to avoid direct interference with this mechanism.

Table 20 shows the results of this experiment. We compare TIMEX to Integrated Gradients (IG) performance because, given the nuance of learning from irregularly-sampled datasets [S23], most

IG

Dynamask

Transformer

CNN

LSTM

Ours

IG

Dynamask

0,650

0.625

0050

0.575

0.550

0.525

43

1.3

1.9

N

0.5

0.0

40

0.5

0.6

0.4

0-2

#0

0.0

0,700

0.475

0.650

0,625

0.600

0.575

0.330

0525

40

2.0

1.5

1.0

0.5

0.0

43

0.8

0.6

0,A

0.2

40

0.540

0-535

0.530

0.525

0.520

0,313

0.510

0.505

40

1.5

9.5

49

1.0

0,8

06

0,4

0.,7

43

LO

0.540

0.535

0.530

0525

0.526

A.515

8540

R.545

2.0

1-5

1-9

0-5

0.9

40

0.8

9.6

0.A

02

40

0-

6,58

6.56

6.53

0,34

53

0.32

49

1.6

0,8

06

04

0.2

0.0

40

1.0

0U5

0,6

0.7

40

9.57

0.56

0.55

0.54

9.33

250

0.51

1.0

0.8

9,4

40

-L2

1.f

9,4

9.3

40

baselines do not apply to irregularly-sampled time series datasets without significant changes that are out-of-scope for our work. TIMEX demonstrates superior performance in this setting, outperforming IG by an over 1.5x improvement in AUPRC.

0

100

200

300

400

500

600

700

1.75

1.50

1.25

1.00

0.75

0.50

Input

720

725

730

735

740

1.20

1.15

1.10

1.05

Predicted

0

100

200

300

400

500

600

700

Time step

2.00

1.75

1.50

1.25

1.00

720

725

730

735

740

Prediction time step

1.20

1.15

1.10

Forecasting. We demonstrate TIMEX 's generalizability to diverse tasks by explaining a forecasting model. We use the ETTh1 dataset [S24] and a vanilla forecasting transformer. To modify TIMEX for forecasting, we first extract embeddings used for MBC by max pooling over hidden states of the decoder. Next, we used a revised LC loss that used MSE as the distance function between predictions rather than JS divergence. We show visualizations of two samples in Figure 8. Explanations are in the left column, while forecasted time steps are in the right column. A few patterns emerge:

TIMEX identifies late time steps as crucial for the forecast, an expected result for a dataset with small temporal variance.

(a): the forecast is an increasing sequence, and TIMEX identifies a region of an expanding sequence (time 450-485). This suggests the model uses this increasing sequence as a reference for forecasting.

(b): a sharp upward spike is forecasted at the beginning of the predicted window. Correspondingly, TIMEX identifies a local minimum around time 260 and a sharp upward spike around time 475-490.

This preliminary experiment demonstrates that TIMEX shows the potential to extract meaningful explanations from forecasting datasets.

C.10 Quantitative analysis of landmark explanations

1.0

1.5

2.0

2.5

3.0

3.5

4.0

Average DTW

0.0

0.2

0.4

0.6

0.8

1.0

1.2

Relative Counts

Random Explanations

Top 10 Landmarks

To examine landmark quality on the ECG dataset, we compare two groups: 1) the landmark group, with the five nearest-neighbors around the top 10 filtered landmarks, and 2) the random group, with five random explanations. We then compare the structure of the most salient values in the samples. We mask in the top-10 time steps as identified by TIMEX, then compute DTW [S25] distance between samples in each group. We then plot the distribution of average within-group DTW distances in Figure 9. A lower average DTW within their groups demonstrates the high quality of learned landmarks.

We have run an additional experiment comparing the clustering performance of our landmarks to those learned by k-means on the final latent space. On the ECG dataset, we match embeddings to their nearest landmarks, to their nearest k-means cluster centroids, and to randomly-selected points as a baseline. For each method, we use 50 clusters. We then evaluate each clustering method's Normalized Mutual Information (NMI) and Adjusted Rand Index (ARI), which are standard clustering metrics, against the ground-truth labels and report the standard error (+/-) computed over 5-fold cross-validation. Higher metrics for one set of centroids would indicate that proximity is more meaningful for prediction. The results are shown in Table 21. Here, we see higher NMI and ARI for landmarks, which means the landmarks are a better heuristic for forming clusters than the K-means centroids for this task.

Appendix References

[S1] Penghang Yin, Jiancheng Lyu, Shuai Zhang, Stanley Osher, Yingyong Qi, and Jack Xin. Understanding straight-through estimator in training activation quantized neural nets. arXiv preprint arXiv:1903.05662 , 2019.

[S2] Pengyu Cheng, Chang Liu, Chunyuan Li, Dinghan Shen, Ricardo Henao, and Lawrence Carin. Straight-through estimator as projected wasserstein gradient flow. arXiv preprint arXiv:1910.02176 , 2019.

[S3] Veenu Rani, Syed Tufael Nabi, Munish Kumar, Ajay Mittal, and Krishan Kumar. Selfsupervised learning: A succinct review. Archives of Computational Methods in Engineering , pages 1-15, 2023.

[S4] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning , pages 8748-8763. PMLR, 2021.

[S5] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning , pages 1597-1607. PMLR, 2020.

[S6] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 9729-9738, 2020.

[S7] Xun Wang, Xintong Han, Weilin Huang, Dengke Dong, and Matthew R Scott. Multi-similarity loss with general pair weighting for deep metric learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 5022-5030, 2019.

[S8] Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. Temporal cycle-consistency learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 1801-1810, 2019.

[S9] Vipin Pillai, Soroush Abbasi Koohpayegani, Ashley Ouligian, Dennis Fong, and Hamed Pirsiavash. Consistent explanations by contrastive learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , pages 10213-10222, 2022.

[S10] Tao Han, Wei-Wei Tu, and Yu-Feng Li. Explanation consistency training: Facilitating consistency-based semi-supervised learning with interpretability. In Proceedings of the AAAI conference on artificial intelligence , volume 35, pages 7639-7646, 2021.

[S11] Hao Guo, Kang Zheng, Xiaochuan Fan, Hongkai Yu, and Song Wang. Visual attention consistency under image transforms for multi-label image classification. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 729-739, 2019.

[S12] Matthew Watson, Bashar Awwad Shiekh Hasan, and Noura Al Moubayed. Using model explanations to guide deep learning models towards consistent explanations for ehr data. Scientific Reports , 12(1):19899, 2022.

[S13] Sanjoy Dasgupta, Nave Frost, and Michal Moshkovitz. Framework for evaluating faithfulness of local explanations. In International Conference on Machine Learning , pages 4794-4815. PMLR, 2022.

[S14] Huanlai Xing, Zhiwen Xiao, Dawei Zhan, Shouxi Luo, Penglin Dai, and Ke Li. Selfmatch: Robust semisupervised time-series classification with self-distillation. International Journal of Intelligent Systems , 37(11):8583-8610, 2022.

[S15] Lujun Li and Zhe Jin. Shadow knowledge distillation: Bridging offline and online knowledge transfer. Advances in Neural Information Processing Systems , 35:635-649, 2022.

[S16] Defang Chen, Jian-Ping Mei, Hailin Zhang, Can Wang, Yan Feng, and Chun Chen. Knowledge distillation with the reused teacher classifier. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 11933-11942, 2022.

[S17] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A. Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence , 2(11):665-673, Nov 2020.

[S18] Lukas Faber, Amin K. Moghaddam, and Roger Wattenhofer. When comparing to ground truth is wrong: On evaluating gnn explanation methods. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining , pages 332-341, 2021.

[S19] Borys Surawicz, Rory Childers, Barbara J Deal, and Leonard S Gettes. Aha/accf/hrs recommendations for the standardization and interpretation of the electrocardiogram: part iii: intraventricular conduction disturbances: a scientific statement from the american heart association electrocardiography and arrhythmias committee, council on clinical cardiology; the american college of cardiology foundation; and the heart rhythm society: endorsed by the international society for computerized electrocardiology. Circulation , 119(10):e235-e240, 2009.

[S20] Mariana Floria, Alexandra Noela Parteni, Ioana Alexandra Neagu, Radu Andy Sascau, Cristian Statescu, and Daniela Maria Tanase. Incomplete right bundle branch block: Challenges in electrocardiogram diagnosis. Anatolian Journal of Cardiology , 25(6):380, 2021.

[S21] Chirag Agarwal, Eshika Saxena, Satyapriya Krishna, Martin Pawelczyk, Nari Johnson, Isha Puri, Marinka Zitnik, and Himabindu Lakkaraju. Openxai: Towards a transparent evaluation of model explanations. arXiv preprint arXiv:2206.11104 , 2022.

[S22] Narine Kokhlikyan, Vivek Miglani, Miguel Martin, Edward Wang, Bilal Alsallakh, Jonathan Reynolds, Alexander Melnikov, Natalia Kliushkina, Carlos Araya, Siqi Yan, and Orion ReblitzRichardson. Captum: A unified and generic model interpretability library for pytorch, 2020.

[S23] Xiang Zhang, Marko Zeman, Theodoros Tsiligkaridis, and Marinka Zitnik. Graph-guided network for irregularly sampled multivariate time series. In International Conference on Learning Representations, ICLR , 2022.

[S24] Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In Proceedings of the AAAI conference on artificial intelligence , volume 35, pages 11106-11115, 2021.

[S25] Meinard Müller. Dynamic time warping. Information retrieval for music and motion , pages 69-84, 2007.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper introduces a novel method to train an interpretable surrogate of pre-trained  time series classification models. TimeX produces a latent embedding of time series observation and outputs classification probabilities that are both consistent with a reference model. At the same time, it identifies time localized patterns in the time series that allowed it to make predictions. Last, it learns landmarks in the latent space that allow the user to easily compare the observed time series.\n\nFrom pre-trained encoder $G$ and decoder $F$, TimeX trains an explanation generator $H_E$, encoder $G_E$ and decoder $F_E$. $H_E$ produces a discrete masking function that allows to localize and consider only sparse yet connected regions of interest in the input time series. $G_E$ and  $F_E$ are jointly trained to respectively preserve the \"topology\" of the latent spaces and the output distributions.  \n\nPlease note that the submission is not in my area of expertise. I can assess the soundness of the claims and the presentation but it is hard to evaluate its broader contribution to the field.\n\nSTRENGTHS:\nThe notion of Model Behavior Consistency is, from my understanding, the main contribution of this paper. Although many methods aim at  embedding high dimensional observations in topology-preserving latent spaces, the idea of learning an interpretable embedding consistent with pre-trained models is novel to my knowledge. I find the approach particularly relevant as high-capacity models become more and more accessible.\n\nAlthough the technical description of the method is not very well written (see below), each modeling choice is convincing and well motivated (each term of the *ad-hoc* loss is easily interpretable and the need for discrete masking for time series is well demonstrated). \n\nThe experimental results demonstrate improved performance that I cannot really evaluate (see above).\n\nWEAKNESSES:\n1) Some statements seem inaccurate if not incorrect. (I will be happy to be proven wrong, as I am not an expert in Time-Series Classification)\n\n   - line.22 \"State-of-the-art time series models are high-capacity pre-trained neural networks\" -> This might be true for time-series classification, but seems wrong in other areas like forecasting, where uncertainty quantification is key. \n\n   - There is an apparent conflict between the need for \"pinpointing the specific location [...] that influence the model's prediction\" (line 24) and the fact that \"temporal patterns only show up when looking at time segments and long term trends\" (line 54). For example, if the feature of interest is the frequency content of a time series, it seems pointless to precisely localize it in time. From my understanding, TimeX reaches an in-between suitable to pinpoint patterns \"broadly-localized\" in time. The paper would gain in clarity by stating more clearly what the method is trying to achieve. \n\n   - line 47. \"the uninterpretable nature of time series data\". I would avoid such vague statements. For example, the QRS intervals subsequently analyzed are straightforwardly interpretable and corresponds to ventricles depolarization and heart contraction.\n\n2) The description of the method is not intelligible but could easily be improved. \n   - line 154. The functions $D_Z$ and $D_Z^E$ are used to motivate Model Behavior Consistency, but it is not explained that they convey a notion of distance in the latent space (this only shows up line 241)\n\n   - Although I understand  the relationship $D_Z(z_i, z_j) \\approx D_Z^E(z_i^E, z_j^E)$ (line 154) and its implication, it is very confusing to write $z_j^E = G^E(E(x_i))$ (line 153).  $z_j^E$ is a latent representation of the masked time series $x^m_j$. And $E$ is defined above as explanation that takes value in $[0, 1]$ (see line 189). Did I miss something ? \n\n   - The notation $H^E: \\mathcal{X} \\rightarrow p \\in [0, 1]^{T \\times d}$ does not make sense (line 184). Is $\\mathcal{X}$ the input space of the function $H^E$ or its input ? In the former case, one should write $H^E: \\mathcal{X} \\rightarrow [0, 1]^{T \\times d}$. In the latter case it implies that the mask applies uniformly to the whole dataset $\\mathcal{X} = (x_i)_i$ which contradicts my intuition from Figure 2.\n\n3) Figure 4 clearly illustrates what part of the ECG the model based its prediction on. Nevertheless, there is no further analysis of the discovered temporal patterns. Are they unexpected or are they stereotyped signals easily classifiable by a physician ? In the latter case, it would have been interesting to use an additional classification task and illustrate how TimeX can identify new temporal patterns in observations, and possibly be used for exploratory data analysis.\n\nMinor points: line 91. XAI: abrevation not defined\n\nQUESTIONS:\n1) I did not understand how and exactly when the Landmarks are learned. Is it post-hoc ? Or is there some partial overlap with the training of the rest of the model which encourages the finding a parsimonious latent embedding ?\n\n2) It is not really discussed how the two latent spaces dimensions are related. Since $G^E$ is initialized with $G$, I am assuming that they are the same, but I imagine that one might use a lower dimensional embedding space of explanation. It would be relatively straightforward to initialize $G^E:= P G$ where $P$ is a linear projection on a lower dimensional space. Would it make the model even more interpretable (and avoid post-hoc treatment with UMAP as in Figure 2) or would it penalize the model too much ?\n\nLIMITATIONS:\nAuthors adequately addressed the limitations of their model.", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 2, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2023-06-19"}

comments: SUMMARY:
This paper proposed TimeX that creates an interpretable surrogate model for pretrained models. To ensure faithfulness to the reference model, this paper introduces a self-supervised objective, model behavior consistency, a novel formulation that ensures the preservation of relationships in the latent space induced by the pretrained model, as well as the latent space induced by TimeX. As a result, TimeX could find well-distributed landmarks and highlight a range of salient timestamps.

STRENGTHS:
1. It is well-written and has strong motivation.
2. This is the first paper to suggest in-hoc explanations for time series data.
3. This article offers additional justifications for its design decisions, including discrete masking and consistency learning.
4. The evaluation is very convincing, using diverse datasets and many compared methods.

WEAKNESSES:
1. No discussion about the quality of explanation. Please see questions.

QUESTIONS:
1. Any metric for the quality of the explanation? For example, better explanation should show high IoU with ground truth. This kind of qualitative analysis would assure the superiority of TimeX.
2. If Table 3 is at the top of the page, the visibility would be improved.

LIMITATIONS:
The limitation that authors provided is acceptable as there is no ground truth for other tasks except classification.
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 4
DATE: 2023-07-03

comments: SUMMARY:
This paper presents an in-hoc interpretability mechanism to explain time series prediction. In particular, the authors train an interpretable surrogate model by learning H^E and G^E in the embedding space.

The objective function optimizes model behavior consistency by considering the distance in the training embedding, Z, and explained embedding, Z^E.

STRENGTHS:
1. Discrete masking as opposed to continuous masking
2. Landmark to partition latent space visualization and shape of the signal
3. Can be generalized to other classification tasks and neural model architectures

WEAKNESSES:
As demonstrated by the ablation studies, the label alignment (LA) loss is always better than MBC in isolation.

QUESTIONS:
Table 12 results in the Supplementary materials require an explanation of the SeqComb-MV dataset. Specifically, the  MBC and LA loss in isolation has very poor AUP, ~0.0576. But the combined MBC + LA results in AUP 0.8326. The performance boost is really large.

Do the authors have any explanation for this behavior?

LIMITATIONS:
Yes, the authors explained use cases where their model is not the best.
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 4
DATE: 2023-07-04

comments: SUMMARY:
TimeX proposes a explanation module that is trained along-side the model to provide more consistent explainiations. This is done by making the internal embeddings of explaination modules consistent with that of full model such as distance consistency and label consistency.

STRENGTHS:
1. The methodology is well motivated and presented.
2. The consistency losses encourage expaliation module features to learn from latent space of the model.
3. The synthetic experiments are well setup and model provides significant performance improvements in synthetic and real-world dataset.

WEAKNESSES:
1. The novelty of the method seems unclear. Model consistency has been previously explored in neural explainations and this work dovtails to time-series models.
2.What is the additional computational complexity or resources required to train the explainer modules? How does it compare to other methods?

QUESTIONS:
See weaknesses

LIMITATIONS:
The paper presents a model behaviour consistency based method of generate explainations for time-series models. While the results are very significant, computational requirements relative to other post-hoc methods and the performance vs compute tradeoff is not clear.
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 3
DATE: 2023-07-09

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper introduces a novel time series interpretability model called TIMEX. The challenge of interpreting time series models arises from the need to identify both the specific time series signals influencing predictions and their alignment with interpretable temporal patterns. TIMEX addresses the issue of model faithfulness by introducing model behavior consistency, ensuring relations in the latent space induced by the pretrained model are preserved when compared to relations in the TIMEX-induced latent space.\n\nTIMEX provides discrete attribution maps, giving interpretable explanations for the model's predictions. Unlike existing methods, TIMEX goes further by learning a latent space of explanations, enabling visual aggregation of similar explanations and recognition of temporal patterns.\n\nThe evaluation of TIMEX on 4 synthetic and 4 real-world datasets, which includes case studies involving physiological time series, demonstrates its superior performance compared to state-of-the-art interpretability methods. TIMEX's innovative components hold promise for training interpretable models that capture the behavior of pretrained time series models.\n\nSTRENGTHS:\nOverall the proposed method is novel, effective, and well-evaluated. The main strengths of the paper are as follows:\n\n1. The paper proposes a novel method for explaining time series models that is based on self-supervised learning. This approach has several advantages over traditional explanation methods, such as being able to learn explanations for models with complex temporal dynamics. The paper provides a clear and concise overview of the problem of explaining time series models and provides a detailed description of the TimeX method, including the rationale behind the design choices.\n\n2. The authors presents a comprehensive evaluation of TimeX on a variety of experiments with time series models and datasets. The results show that TimeX is able to provide interpretable explanations that are both faithful to the model's predictions and informative about the underlying temporal patterns.\n\n3. The paper also includes a number of case studies that demonstrate the use of TimeX to explain the predictions of time series models in real-world applications. These experiments help highlighting TimeX's capability to be used for gaining insights into the behavior of time series models and to identify potential problems with the models.\n\n4. The authors evaluate TimeX through an extensive set of ablations and on a variety of time series models. TimeX shows to be effective in explaining a variety of time series models, including LSTM, CNN, and vanilla-Transformer model. This suggests that TimeX is a general-purpose method for explaining time series models.\n\nWEAKNESSES:\nThe are a few weaknesses that if addressed or identified as a limitation for future can improve the paper:\n\n1. As the current setup is presented, the model does not handle variable length time-series which is a common occurrence in medical time-series data. This could prove to be challenging to be extended from the current state of TimeX as aligning different time-series that have variable length would also become important.\n\n2. Another common challenge of dealing with time-series data that is not addressed in the paper, is handling irregular time-step intervals. A discussion of this important limitation is missing in the paper. Irregularly sampled time-series is predominantly present in healthcare data that this paper focuses on and is important weakness of the TimeX that is not mentioned in the paper.\n\n3. The method has not been evaluated on a wide range of different tasks. The authors of the paper evaluated TimeX on a variety of time series models and datasets, but they did not evaluate TimeX on a wide range of tasks. This means that it is not clear how well TimeX would perform on other tasks, such as anomaly detection or forecasting.\n\n4. TimeX currently does not handle temporal prediction (i.e. a prediction task where prediction is done at every time-step), and it is unclear how it can be expanded to provide explanations for models designed for such tasks.\n\nQUESTIONS:\n1. In appendix, some of the explanations of the SeqComb-UV is visualized. The repeating patterns can all be seen to be happening around the same time points. Is TimeX capable of identifying patterns that are not necessarily aligned in absolute time between two patients? \n\n2. Paper would be improved if there were additional experiments on different choices of $r$ presented, as at its current state, a reader unfamiliar with [46] will have a hard time deciphering the effect of different values of $r$.\n\n3. Why is cosine similarity used in Equation 3? For SimCLR this would have made sense as the embedding of SimCLR is on the unit hyper-sphere and thus cosine similarity is an appropriate choice. But since the embeddings here are not constrained to be on the hyper-sphere I am uncertain why encoding through the notion of directionality would be helpful here.\n\n4. Wouldn’t it be more appropriate to normalize $L_{MBC}$?\n\n5. How does the differentiable attention masking presented in the appendix come into play for the model? Also this should be referring to section 4.2 instead of 4.1 as currently printed in the appendix.\n\n6. Following the methods section, I am still uncertain as to why TIMEX is considered to be an in-hoc model and not a surrogate method. The paper would become easier to follow, if the authors can draw a parallel here and clear this uncertainty in the introduction.\n\n7. The appendix currently provides an extensive list of experiments. One additional point to improve the already thorough analysis would be to visualize and see how much the explanations found differ for different underlying models tested (transformer, LSTM, CNN).\n\n8. In the appendix the running time of the model is presented, but how does it compare to other baselines in your experiments?\n\n\nMinor comments:\n1. In section 3.1, $F^E$ should be defined as otherwise $F(z_i^E)$ would imply that $z_i^E$ and $z_i$ belong to the same space.\n2. Line 213 has a typo: we [use] a direct-value masking procedure. (\"use\" is missing).\n3. Specifics of how the transformer encoder-decoder was used should be added to appendix for reproducibility of results.\n\nLIMITATIONS:\nThe paper does not contain any discussion on the potential societal impact of their work. As interpretability opens a broad avenue for discussion about this topic, I believe this section is essential to be added to the paper.\n\nAdditionally, the current limitations section is quite coarse. The authors can improve the paper by better expanding on the limitations of TimeX at its current state and the interesting directions for the future works.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 4, "DATE": "2023-07-27"}