Source-linked AI summary

Explaining Time Series Predictions with Dynamic Masks

Jonathan Crabbé, Mihaela van der Schaar

arXiv:2106.05303v1cs.LGcs.AI

TL;DR

Time-series explanations must respect temporal dependence and remain legible as feature-time inputs multiply. Dynamask fits dynamic perturbation masks to black-box sequences and promotes parsimonious, nearly binary selections. The paper reports a neat performance improvement and positions the method for greater transparency in medicine and finance.

  • Problem

    Multivariate time-series explanations need to retain temporal dependence, while many feature-time inputs make importance maps difficult to interpret.

    Source: §1 · p. 2
  • Method

    Dynamask fits perturbation masks to black-box time-series inputs, using dynamic perturbations and parsimonious, nearly binary masks assessed with information-theoretic measures.

    Source: §1 · p. 2
  • Results

    Dynamask offers a neat improvement in performance.

    Source: §4 · p. 9
  • Takeaways & Limitations

    Dynamask is presented as useful for increasing transparency around black-box predictions in medicine and finance.

    Source: §4 · p. 9

    The authors identify more sophisticated consistency tests for saliency methods in dynamic settings as future work.

    Source: §4 · p. 9

Abstract

from arXiv · show

How can we explain the predictions of a machine learning model? When the data is structured as a multivariate time series, this question induces additional difficulties such as the necessity for the explanation to embody the time dependency and the large number of inputs. To address these challenges, we propose dynamic masks (Dynamask). This method produces instance-wise importance scores for each feature at each time step by fitting a perturbation mask to the input sequence. In order to incorporate the time dependency of the data, Dynamask studies the effects of dynamic perturbation operators. In order to tackle the large number of inputs, we propose a scheme to make the feature selection parsimonious (to select no more feature than necessary) and legible (a notion that we detail by making a parallel with information theory). With synthetic and real-world data, we demonstrate that the dynamic underpinning of Dynamask, together with its parsimony, offer a neat improvement in the identification of feature importance over time. The modularity of Dynamask makes it ideal as a plug-in to increase the transparency of a wide range of machine learning models in areas such as medicine and finance, where time series are abundant.

1. Introduction and context

The introduction argues that time-series saliency must retain temporal context while keeping explanations manageable. Dynamask is proposed as a perturbation-mask method addressing context, parsimony, and legibility.

1. Introduction and context

  • Most saliency work has focused on images and tabular data, while time-series explanations have received little attention (Barredo Arrieta et al., 2020).Source: §1 · p. 2
  • Treating every feature-time input as independent can discard ordering, although recurrent predictions may depend on temporal context.The introduction notes that recurrent models use memory cells and that static methods forget context when treating time steps as separate features.Source: §1 · p. 2
  • Attention scores retain the data's dynamic structure, but attention weights can change without changing predictions, clouding their interpretation as feature importance.Source: §1 · p. 2
  • The feature-by-time input count can make saliency maps overwhelming, motivating parsimony and legibility.The introduction defines parsimony as selecting no more inputs than necessary and legibility as keeping score analysis simple.Source: §1 · p. 2
  • Dynamask fits post-hoc perturbation masks to time-series inputs, using dynamic perturbations to preserve adjacent-time context.The introduction presents it as a saliency method for any time-series model.Source: §1 · p. 2
  • Its proposed design makes masks extremal for parsimony and nearly binary, with information-theoretic mask information and entropy to assess legibility.An extremal mask selects the minimum number of inputs needed to reconstruct the black-box prediction at a given precision.Source: §1 · p. 3

2. Mathematical formulation

Dynamask explains an individual black-box prediction with a feature-by-time mask and perturbations that can incorporate neighboring time steps. Its optimization balances prediction fidelity with parsimonious selection, while mask information and entropy characterize useful information and legibility.

2.1. Preliminaries

  • A same-shape mask assigns each feature at each time step an importance score for explaining an individual black-box prediction.Values near 1 mark salient inputs; values near 0 indicate the opposite.Source: §2.1 · p. 3

2.2. Perturbation operators

  • A mask-associated perturbation operator is linear and coefficient-controlled, differentiable for interior mask values, continuous at the boundaries, and trivial when a coefficient is one.These conditions support gradient-based optimization and make perturbations less influential on inputs marked salient.Source: §2.2 · pp. 3–4
  • A perturbation is dynamic when it uses a feature’s values at neighboring times; W1 and W2 control dependence on past and future steps.At least one of W1 or W2 must be nonzero.Source: §2.2 · p. 4

2.3. Mask optimization

  • The mask objective keeps perturbed predictions close to the original, using a task-dependent error term, such as squared error for regression or cross-entropy for classification.A separate optional loss can penalize jumps in saliency over time.Source: §2.3 · p. 5
  • The area regularizer encourages a user-chosen fraction a of inputs to be highlighted and promotes binary, more legible masks.Changing a can reveal features gradually in order of importance.Source: §2.3 · p. 5
  • An extremal mask seeks the smallest input fraction that reproduces the black-box prediction within an acceptable precision threshold.This formulation makes parsimony explicit rather than fixing the fraction in advance.Source: §2.3 · p. 5

2.4. Masks and information theory

  • Mask information scores useful information in a subsequence, while mask entropy captures ambiguity and legibility; the latter is not Shannon entropy.The information interpretation treats mask coefficients as saliency probabilities, and lower-entropy masks are sharper and easier to read.Source: §2.4 · p. 6

2. Additivity

The section characterizes mask information and entropy through measure properties and describes how they can support comparisons across saliency methods.

2. Additivity

  • The passage labels a section “Monotonicity” and introduces it under the condition A ⊂ B, but does not specify the quantity or relationship involved.Source: §2 · p. 6
  • In Figure 3, adding relevant features increases information, while reducing map sharpness increases entropy.High-entropy masks appear less legible, especially for long sequences.Source: Figure 3 · p. 7
  • Together, the stated properties make mask information and entropy measures on the discrete σ-algebra of input indexes..Source: §2 · p. 7
  • Both metrics can be computed for any saliency method, allowing comparisons across methods..Source: §2 · p. 7

3. Experiments

The evaluation progresses from white-box and synthetic black-box tests with known salient inputs to MIMIC clinical mortality prediction. Dynamask performs well across these settings, while the synthetic classifier comparison also exposes a parsimony difference with Integrated Gradients.

3. Experiments

  • The experiments increase in difficulty from a white-box with known feature importance, to a black-box with known importance, to a real-world clinical dataset.The clinical experiment fits a recurrent classifier to 48 hours of patient features from MIMIC-III.Source: §3 · p. 7, §3.3 · pp. 8–9

3.1. Feature importance for a white-box regressor

  • Across both white-box experiments, AUP did not discriminate methods, while Dynamask significantly improved the other metrics, including AUR, and produced low-entropy masks.The experiments consider rare salient features and rare salient times.Source: §3.1 · pp. 7–8, Table 1 · p. 7, Table 2 · p. 8

3.2. Feature importance for a black-box classifier

  • Dynamask reaches AUROC = 0.93 ± 0.00 and AUPRC = 0.85 ± 0.00, versus Integrated Gradient’s AUROC = 0.91±0.00 and AUPRC = 0.79±0.00.The reported comparison uses the state-experiment benchmark results.Source: Table 3 · p. 8, §3.2 · p. 8
  • Integrated Gradients identifies 87% of inputs as salient versus Dynamask’s 32%, although only one-third are truly salient.Integrated Gradients has higher AUR, but significantly lower AUP; Dynamask outperforms the other benchmarks on three of four metrics.Source: §3.2 · p. 8

3.3. Feature importance on clinical data

  • Dynamask-selected observations had the greatest impact on predictions when replaced in the MIMIC mortality experiment.The authors note that high ACC suggests time-average replacement rarely produces a counterfactual input.Source: Figure 4 · p. 9, Figure 5 · p. 9, §3.3 · p. 9

4. Conclusion

The conclusion presents Dynamask as a saliency method for multivariate time series with an information-theoretic interpretation and improved performance. The accompanying appendix defines normalized mask metrics and shows how to associate masks with other saliency methods.

4. Conclusion

  • Dynamask is designed for multivariate time series, has an information-theoretic interpretation, and is reported to improve performance, with applications in medicine and finance.Source: §4 · p. 9

A.2. Normalized information and entropy

  • Normalized mask information and entropy express the fraction of total mask information or entropy contained in an input subsequence.Both normalized quantities lie between 0 and 1.Source: §A.2 · p. 13

A.3. Definition of a mask for other saliency methods

  • For another saliency method, normalizing its importance-score matrix yields an associated mask that can be used to compute mask information and entropy.Source: §A.3 · pp. 13–14

A.1. Proofs

The appendix establishes positivity, additivity, and monotonicity properties for mask information and entropy.

  • Mask information and entropy are positive, and each is additive over disjoint input sets.Source: §A.1 · p. 13
  • Both mask information and entropy are monotone: for A ⊂ B, their value on A does not exceed their value on B.Source: §A.1 · p. 13

B. More details on the implementation

The implementation optimizes a bounded mask using prediction error, mask-area regularization, and a time-variation term. A deletion variant instead seeks to maximize prediction shift under perturbation.

B.1. Algorithm

  • The algorithm initializes a mask and area target, evaluates prediction error and area loss, then updates and clamps the mask while increasing the area-regularization weight.The regularization weight grows exponentially, making the optimized mask almost binary by the end.Source: §B.1 · p. 14

B.2. Deletion variant

  • The deletion variant flips the error term and evaluates the prediction shift on 1 − M, so salient inputs can remain marked in M while being maximally perturbed.The mask-area regulator remains unchanged.Source: §B.2 · p. 14

C.1. Metrics

The appendix defines metrics for evaluating saliency masks when true importance is known and when it is unknown, as in MIMIC-III. It also reports the computing hardware used for the experiments.

C.1. Metrics

  • AUP and AUR evaluate mask-based estimates of true saliency across detection thresholds.The mask threshold defines which inputs are classified as salient; AUP and AUR are areas under the resulting precision and recall curves.Source: §C.1 · pp. 14–15
  • For MIMIC-III, where ground-truth feature importance is unknown, the experiments use cross-entropy and accuracy to measure prediction changes after perturbation.The perturbed inputs replace the most important features with their time averages.Source: §C.1 · p. 15

C.2. Computing infrastructure

  • Experiments ran on an Intel Core i5-8600K CPU and an Nvidia GeForce RTX 2080 Ti GPU.The machine had six CPU cores.Source: §C.2 · p. 15

C.3. Details on the rare experiment

The rare-feature and rare-time experiments test Dynamask on synthetic time series with known salient inputs. The reported masks identify more truly salient inputs, and the fitting error plateaus near a mask area of 0.05.

C.3. Details on the rare experiment

  • Each rare-feature example has 50 length-50 ARMA feature series, with five features salient during times 13–38.The ARMA process uses coefficients 0.25, 0.1, and 0.05, with Gaussian noise.Source: §C.3 · p. 15
  • Rare-time cases designate five consecutive salient time steps and salient features 13–38.The starting salient time is drawn uniformly from 1–46.Source: §C.3 · p. 15
  • For each time series, masks are fitted using temporal Gaussian-blur perturbations with σmax = 1 and squared-error loss, and the mask for the tested a with lowest squared error is selected.In the experiments, values a > 0.05 are not considered.Source: §C.3 · p. 15
  • The fitting error plateaus near a=0.05 in the rare-feature example, consistent with the fraction of inputs that are truly salient.Figure 6 plots the error against a.Source: §C.3 · p. 16, Figure 6 · p. 16
  • Dynamask identifies a bigger portion of truly salient inputs in rare-feature and rare-time examples, illustrating its bigger AUR.The examples are shown in Figures 8–11.Source: §C.3 · p. 16

C.4. Details on the state experiment

The state experiment generates time series whose labels depend on the current hidden state and one state-specific feature. Its illustrations report that Dynamask and Integrated Gradients reveal the true salient pattern, while Dynamask produces lower-entropy masks.

C.4. Details on the state experiment

  • At each time step, three input features are generated, and the binary label depends on the second or third feature according to the hidden state.The label probability is given by a logistic function of the state-selected feature.Source: §C.4 · p. 16
  • The experiment generates 1,000 series of length 200, using 800 for training and 200 for testing; the model is a one-layer RNN with 200 GRU cells.The RNN is trained for 80 epochs with Adam.Source: §C.4 · p. 16
  • For each test series, masks are fitted using temporal Gaussian-blur perturbation with σmax=1.The optimization is performed for multiple values of a.Source: §C.4 · p. 16
  • Only Dynamask and Integrated Gradients appear to distinguish the true salient pattern; Dynamask also produces masks with significantly lower entropy.The authors relate high entropy to weak contrast or fuzzy saliency maps.Source: §C.4 · p. 17

C.5. Details on the mimic experiment

The MIMIC-III experiment applies Dynamask to ICU mortality predictions, and its illustrations report that selected features produce the largest prediction shifts. A separate state-experiment comparison finds similar performance across three perturbation operators.

C.5. Details on the mimic experiment

  • The MIMIC-III data comprise 48 hourly blocks for 31 features per ICU admission, with mortality probability as the label.The dataset is split into training, validation, and test sets; missing values are imputed and features standardized.Source: §C.5 · p. 17
  • For each test patient, the experiment fits a deletion-formulation mask with a=0.1, using fade-to-moving-average perturbation with W=48.The model is a one-layer RNN with 200 GRU cells, trained for 80 epochs.Source: §C.5 · p. 17
  • For predicted deaths and survivals, Dynamask identifies features that create the biggest prediction shift and tends to emphasize later inputs.The authors connect the late-time focus with the 48-hour mortality prediction target and RNN short-term memory.Source: §C.5 · p. 17, Figure 14 · p. 24, Figure 15 · p. 24

C.6. Influence of the perturbation operator

  • Gaussian blur, fade-to-moving-average, and fade-to-past-average perturbations generally agree and offer similar AUROC performance.The comparison uses mask agreement and AUROC for identifying truly salient inputs; Table 4 reports the results.Source: §C.6 · p. 17, Table 4 · p. 17
Loading 2106.05303v1…