MCPcopy Index your code
hub / github.com/ayaabdelsalam91/TS-Interpretability-Benchmark

github.com/ayaabdelsalam91/TS-Interpretability-Benchmark @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
161 symbols 478 edges 26 files 7 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Benchmarking Deep Learning Interpretability in Time Series Predictions

Code implementing the benchmark introduced in "Benchmarking Deep Learning Interpretability in Time Series Predictions" by Aya Abdelsalam Ismail, Mohamed Gunady, Hector Corrada Bravo, Soheil Feizi.

alt text

Overview:

Saliency methods are used extensively to highlight the importance of input features in model predictions. These methods are mostly used in vision and language tasks, and their applications to time series data is relatively unexplored. In this paper, we set out to extensively compare the performance of various saliency-based interpretability methods across diverse neural architectures, including Recurrent Neural Network, Temporal Convolutional Networks, and Transformers in a new benchmark of synthetic time series data. We propose and report multiple metrics to empirically evaluate the performance of saliency methods for detecting feature importance over time using both precision (i.e., whether identified features contain meaningful signals) and recall (i.e., the number of features with signal identified as important). Through several experiments, we show that (i) in general, network architectures and saliency methods fail to reliably and accurately identify feature importance over time in time series data, (ii) this failure is mainly due to the conflation of time and feature domains, and (iii) the quality of saliency maps can be improved substantially by using our proposed two-step temporal saliency rescaling (TSR) approach that first calculates the importance of each time step before calculating the importance of each feature at a time step.

Prerequisites:

  • Python 3.6.3 or higher
  • NumPy
  • Pytorch
  • Matplotlib
  • Pandas
  • Sklearn
  • Argparse
  • Sys
  • timesynth
  • captum

Usage:

  • Create the following folder structure.
TS-Interpretability-Benchmark
    │
    ├── Scripts
    │  ├── Plotting
    │  └── Models
    │ 
    ├──Results
    │  ├── Saliency_Values
    │  ├── Saliency_Masks
    │  ├── Saliency_Distribution
    │  ├── Precision_Recall
    │  ├── Masked_Accuracy
    │  └── Accuracy_Metrics
    │ 
    ├──Models
    │  ├── Transformer
    │  ├── TCN
    │  ├── LSTMWithInputCellAttention
    │  └── LSTM
    │ 
    ├──Graphs
    │  ├── Saliency_Maps
    │  ├── Saliency_Distribution
    │  ├── Precision_Recall
    │  ├── Datasets
    │  └── Accuracy_Drop
    │
    ├── Datasets
    │
    └── MNIST Experiments
        ├── Scripts
        ├── Models
        ├── Graphs
        └── Data
  • The code for the benchmark is available under Scripts folder to run full benchmark run python run_benchmark.py.
  • MNIST experiments and TSR under MNIST Experiments.

Core symbols most depended-on inside this repo

plotExampleBox
called by 37
Scripts/Plotting.py
getTwoStepRescaling
called by 9
MNIST Experiments/Scripts/interpret.py
softmax
called by 8
Scripts/Models/LSTMWithInputCellAttention.py
checkAccuracy
called by 7
Scripts/Helper.py
plotExampleProcesses
called by 6
Scripts/Plotting.py
createSample
called by 3
Scripts/createSimulationDataProcesses.py
data_generator
called by 2
MNIST Experiments/Scripts/utils.py
getMatrixM
called by 2
MNIST Experiments/Scripts/model.py

Shape

Method 75
Function 52
Class 34

Languages

Python100%

Modules by API surface

MNIST Experiments/Scripts/model.py55 symbols
Scripts/Models/Transformer.py24 symbols
Scripts/Models/LSTMWithInputCellAttention.py19 symbols
Scripts/Models/TCN.py13 symbols
Scripts/Helper.py10 symbols
MNIST Experiments/Scripts/train_models.py5 symbols
Scripts/createSimulationDataProcesses.py4 symbols
Scripts/Plotting/PlotSaliencyDistribution.py3 symbols
Scripts/Plotting/PlotPrecisionRecall.py3 symbols
Scripts/Plotting/PlotAccuracyDrop.py3 symbols
Scripts/Models/LSTM.py3 symbols
MNIST Experiments/Scripts/interpret.py3 symbols

For agents

$ claude mcp add TS-Interpretability-Benchmark \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page