Skip to content

VautierNicolas/TAMIS

Repository files navigation

TAMIS

This repository contains the official Python implementation of TAMIS and the ASHES detector, as presented in the paper:

From Benchmarks to Production: Transferring Time Series Anomaly Detection Methods for Electricity Production Monitoring > Nicolas Vautier, Paul Caron, Nardi Xhepi, Félicie Bizeul, Manel Boumghar, Christophe Degouy, Paul Boniol > ICDE 2025

📖 Overview

This project provides a comprehensive framework for time series anomaly detection, featuring:

  • ASHES: A lightweight, interpretable, and scalable anomaly detector designed for industrial time series.
  • TAMIS: A meta-learning model that leverages a rich feature set to provide robust anomaly scores.

📂 Project Structure

.
├── TAMIS/
│   ├── app.py                  # Streamlit dashboard for visualization
│   ├── execute/                # Scripts for batch processing (score/metric computation)
│   ├── features/               # Implementations of individual time series features
│   ├── models/                 # Core detector implementations (TAMIS, ASHES)
│   ├── models_on_features/     # Wrappers for applying detectors on extracted features
│   └── utils/                  # Utility functions for data, windows, and metrics
│
├── benchmark_chooseWisely/
│   ├── 1_Compute_...py         # Script to pre-compute feature-based scores
│   ├── 2_TAMIS_learning...py   # Script to train the TAMIS model for the benchmark
│   ├── 2_Export_...py          # Script to train and export the final TAMIS model
│   ├── 3_Eval.py               # Script to evaluate the benchmark results
│   └── 4_Generate_...py        # Script to generate the final benchmark figure
│
├── data/
│   └── TSB/                    # Root for Time Series Benchmark (TSB) data
│
├── tamis_dataset/              # Contains JO, THERM, and HYDRAU datasets
├── assets/
│   └── figures/                # Contains output figures, like figure.svg
│
└── requirements.txt            # Project dependencies

🎯 Available Detectors

The core of this repository includes three main detectors, each suited for different use cases.

  • ASHES_CONTINUOUS: A vectorized, high-performance implementation of the ASHES algorithm.

    • Best for: Batch processing, retrospective analysis, and large historical datasets.
    • Method: Uses efficient sorting and NumPy vectorization to compute scores across the entire series at once.
  • ASHES_ONLINE: An iterative implementation of the ASHES algorithm.

    • Best for: Streaming simulations and production scenarios requiring strict "past-only" knowledge.
    • Method: Computes the score for each window relative strictly to the history available at that specific time step (no look-ahead).
  • TAMIS: A pre-trained, meta-learning model.

    • Best for: Obtaining high-quality, robust anomaly scores by combining the outputs of multiple feature-based detectors.
    • Method: This detector orchestrates the calculation of numerous underlying features, computes scores on them using base models (like ASHES and KDE), and then feeds this rich feature matrix into a pre-trained XGBoost model for final inference.

🚀 Getting Started

🛠️ Prerequisites

The code requires Python 3.x. This implementation is built upon the architecture of the TSB-UAD (Time Series Benchmark for Unsupervised Anomaly Detection) library. The required libraries can be installed from requirements.txt.

pip install -r requirements.txt

🧪 Reproducing the "ChooseWisely" Benchmark

To reproduce the benchmark results and figures presented in the paper, you must execute the following scripts from the benchmark_chooseWisely/ directory in the specified order.

  1. Compute Feature-Based Scores: This script pre-computes all the necessary scores from the base detectors (ASHES, KDE) on all features.

    python benchmark_chooseWisely/1_Compute_ASHES_KDE_on_features.py
  2. Train the TAMIS Meta-Model: This script uses the pre-computed scores to train the final TAMIS XGBoost model on the designated training set.

    python benchmark_chooseWisely/2_TAMIS_learning_optimised_RAM.py
  3. Evaluate the Model: This script evaluates the trained model on the test set.

    python benchmark_chooseWisely/3_Eval.py
  4. Generate Figures: This final script generates the benchmark result figures from the evaluation output.

    python benchmark_chooseWisely/4_Generate_benchmark_figure.py

🏆 Benchmark Results

The execution of the pipeline above will generate the following results, which are also included in the repository:

Benchmark Results

📊 Datasets

The paper introduces the JO, THERM, and HYDRAU datasets, which contain real-world electricity production time series with semantic missing values.

Refer to the tamis_dataset/ directory or the data/readme.txt file for instructions on how to access and load the benchmarks used in the paper.

👉 Training Your Own TAMIS Model

The repository includes a pre-trained TAMIS_model.json. To retrain this model from scratch using all available data, follow these steps. This is useful if you want to train the model on your own custom dataset or after updating the underlying data.

  1. Compute Feature-Based Scores: This step is the same as the first step of the benchmark reproduction. It ensures all necessary input features for the meta-model are pre-computed.

    python benchmark_chooseWisely/1_Compute_ASHES_KDE_on_features.py
  2. Train and Export the Model: This script trains the XGBoost model on 100% of the available data and saves the resulting weights to data/models/TAMIS_model.json.

    python benchmark_chooseWisely/2_Export_TAMIS_train_on_all_datasets.py

📝 Citation

If you use this code or the datasets in your research, please cite our ICDE 2025 paper:

@inproceedings{tamis2025,
  title={From Benchmarks to Production: Transferring Time Series Anomaly Detection Methods for Electricity Production Monitoring},
  author={Vautier, Nicolas and Caron, Paul and Xhepi, Nardi and Bizeul, Félicie and Boumghar, Manel and Degouy, Christophe and Boniol, Paul},
  booktitle={IEEE International Conference on Data Engineering (ICDE)},
  year={2025}
}

About

Source code for the paper "From Benchmarks to Production: Transferring Time Series Anomaly Detection Methods for Electricity Production Monitoring"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages