We propose LOcal Model Agnostic Time series Classification Explanation (LOMATCE, pronounced "lom-te-see"), a method akin to LIME [1], to explain deep-learning-based time series classifiers. LOMATCE uses parametrized event primitives (PEPs) to extract and parameterize events like increasing trends, decreasing trends, local maxima, and local minima from time series data. These PEPs capture temporal patterns, and facilitating the training of simple, interpretable models like linear regression [2]. Discussing time series in terms of these familiar events makes the explanations more intuitive and comprehensible.
-
experiments: This directory contains code files and results.
-
results: Includes experiment results for each dataset.
- output.log:This file contains the fidelity scores for each dataset and perturbation strategy.
- Example: Evaluation result for FCN model architecture trained on the ECG dataset and zero perturbation strategy can be found at
experiments\results\simulation\ecg200\fcn-zero--2024-04-22_22-04-47\output.log.
-
utils: Contains utility files:
helper_class.py
: Functions for clustering, explanation plots, etc.test_dataloader.py
: Dataloader for the test set.
-
fcn_simulation.py
: Runs the FCN model multiple times with random train-test splits to ensure robustness of results. -
globXplain.py
: Core method implementation, from PEP extraction to applying interpretable models like linear regression to mimic deep learning inference. -
perturbation.py
: Applies various perturbation strategies and generates neighboring samples.
-
Fig 1: The proposed XAI method for deep learning based time series classifiers using Parameterised Event Primitives (PEPs).
Table 1: Explanation faithfulness, with 95% confidence interval, across various perturbation methods.
Dataset | Zero | Mean | Total_mean | Random |
---|---|---|---|---|
ECG | ||||
GunPoint |
Fig 2: Explanation highlights segment significance, relevance scores, and event types (e.g., increasing, decreasing, maxima, minima).
To run the the simulation of the experiment, use the following command:
- For FCN model
python fcn_simulation --dataset [dataset-name] --num_runs [100 ] --class_labels [list of the class names]
- tsai (State-of-the-art Deep Learning library for Time Series and Sequences)
- python >= 3.8
- pytorch