Skip to main content

Evaluation Tool for Time Series Anomaly Detection Methods

Project description

TimeEval logo

TimeEval

Evaluation Tool for Anomaly Detection Algorithms on Time Series.

CI Documentation Status codecov !black PyPI version License: MIT python version 3.9|3.10|3.11|3.12 Downloads

See TimeEval Algorithms for algorithms that are compatible to this tool. The algorithms in that repository are containerized and can be executed using the DockerAdapter of TimeEval.

If you use TimeEval, please consider citing our paper.

📖 TimeEval's documentation is hosted at https://timeeval.readthedocs.io.

Features

  • Large integrated benchmark dataset collection with more than 700 datasets
  • Benchmark dataset interface to select datasets easily
  • Adapter architecture for algorithm integration
    • DockerAdapter
    • JarAdapter
    • DistributedAdapter
    • MultivarAdapter
    • ... (add your own adapter)
  • Large collection of existing algorithm implementations (in TimeEval Algorithms repository)
  • Automatic algorithm detection quality scoring using AUC (Area under the ROC curve, also c-statistic) or range-based metrics
  • Automatic timing of the algorithm execution (differentiates pre-, main-, and post-processing)
  • Distributed experiment execution
  • Output and logfile tracking for subsequent inspection

Installation

TimeEval can be installed as a package or from source.

:warning: Attention!

Currently, TimeEval is tested only on Linux and macOS and relies on unixoid capabilities. On Windows, you can use TimeEval within WSL. If you want to use the provided detection algorithms, Docker is required.

Installation using pip

Builds of TimeEval are published to PyPI:

Prerequisites

  • python >= 3.9, < 3.13

    :warning: Attention!

    A dependency of TimeEval prevents us from supporting Python versions >= 3.13: prts is not updated and depends on NumPy<2.0.0. However, there is no NumPy version below 2.0.0 that supports Python>=3.13.

  • pip >= 20

  • Docker (for the anomaly detection algorithms)

  • (optional) rsync for distributed TimeEval

Steps

You can use pip to install TimeEval from PyPI:

pip install TimeEval

Installation from source

tl;dr

git clone git@github.com:TimeEval/TimeEval.git
cd timeeval/
conda create -n timeeval python=3.9
conda activate timeeval
pip install .

Prerequisites

The following tools are required to install TimeEval from source:

  • git
  • Python > 3.9 and Pip (anaconda or miniconda is preferred)

Steps

  1. Clone this repository using git and change into its root directory.

  2. Create a conda-environment and install all required dependencies:

    conda create -n timeeval python=3.9
    conda activate timeeval
    pip install .
    
  3. If you want to make changes to TimeEval or run the tests, you need to install the development dependencies with: pip install ".[ci]". The optional extra dependencies ".[dev]" contains additional dependencies for the notebooks and scripts packaged with TimeEval.

Usage

Example script:

from pathlib import Path
from typing import Dict, Any

import numpy as np

from timeeval import TimeEval, DatasetManager, Algorithm, TrainingType, InputDimensionality
from timeeval.adapters import FunctionAdapter
from timeeval.algorithms import subsequence_if
from timeeval.params import FixedParameters

# Load dataset metadata
dm = DatasetManager(Path("tests/example_data"), create_if_missing=False)


# Define algorithm
def my_algorithm(data: np.ndarray, args: Dict[str, Any]) -> np.ndarray:
    score_value = args.get("score_value", 0)
    return np.full_like(data, fill_value=score_value)


# Select datasets and algorithms
datasets = dm.select()
datasets = datasets[-1:]
# Add algorithms to evaluate...
algorithms = [
    Algorithm(
        name="MyAlgorithm",
        main=FunctionAdapter(my_algorithm),
        data_as_file=False,
        training_type=TrainingType.UNSUPERVISED,
        input_dimensionality=InputDimensionality.UNIVARIATE,
        param_config=FixedParameters({"score_value": 1.})
    ),
    subsequence_if(params=FixedParameters({"n_trees": 50}))
]
timeeval = TimeEval(dm, datasets, algorithms)

# execute evaluation
timeeval.run()
# retrieve results
print(timeeval.get_results())

Citation

If you use TimeEval in your project or research, please cite our demonstration paper:

Phillip Wenig, Sebastian Schmidl, and Thorsten Papenbrock. TimeEval: A Benchmarking Toolkit for Time Series Anomaly Detection Algorithms. PVLDB, 15(12): 3678 - 3681, 2022. doi:10.14778/3554821.3554873

@article{WenigEtAl2022TimeEval,
  title = {TimeEval: {{A}} Benchmarking Toolkit for Time Series Anomaly Detection Algorithms},
  author = {Wenig, Phillip and Schmidl, Sebastian and Papenbrock, Thorsten},
  date = {2022},
  journaltitle = {Proceedings of the {{VLDB Endowment}} ({{PVLDB}})},
  volume = {15},
  number = {12},
  pages = {3678--3681},
  doi = {10.14778/3554821.3554873}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timeeval-1.5.0.tar.gz (165.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timeeval-1.5.0-py3-none-any.whl (343.2 kB view details)

Uploaded Python 3

File details

Details for the file timeeval-1.5.0.tar.gz.

File metadata

  • Download URL: timeeval-1.5.0.tar.gz
  • Upload date:
  • Size: 165.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for timeeval-1.5.0.tar.gz
Algorithm Hash digest
SHA256 0906f1ab68fc62cce49d6f7e236575584b95dd642edd43554796e41ff04ddcea
MD5 f18306756d7f44025ea9f337aa0e5b09
BLAKE2b-256 9c279179dc5f704c04f9efa4de6a303aa4f774b760ebccb227f9dc24899ab0fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for timeeval-1.5.0.tar.gz:

Publisher: build.yml on TimeEval/TimeEval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file timeeval-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: timeeval-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 343.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for timeeval-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea3ff75ad4264722d6189bbe7aa9298104ee6173b808dcc707a4767707c1ea5d
MD5 0e2e994a9acaee9f82e89475fd23147a
BLAKE2b-256 f030ac291734c572b4897d36542a9cde40c1c53509c994c0538a8974798a1025

See more details on using hashes here.

Provenance

The following attestation bundles were made for timeeval-1.5.0-py3-none-any.whl:

Publisher: build.yml on TimeEval/TimeEval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page