Skip to content

Time series anomaly detection algorithm implementations for TimeEval (Docker-based)

Notifications You must be signed in to change notification settings

TimeEval/TimeEval-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimeEval logo

TimeEval Algorithms

Time Series Anomaly Detection Algorithms for TimeEval.

Description

This repository contains a collection of containerized (dockerized) time series anomaly detection methods that can easily be evaluated using TimeEval. Some of the algorithm's source code is access restricted and we just provide the TimeEval stubs and manifests. We are happy to share our TimeEval adaptations of excluded algorithms upon request, if the original authors approve this.

Each folder contains the implementation of an algorithm that is built into a runnable Docker container using GitHub Actions. We host the algorithm Docker images on GitHub. Thus, the namespace prefix (repository) for the Docker images is ghcr.io/timeeval/.

Overview

Algorithm (folder) Image Language Base image Learning Type Input Dimensionality
arima (restricted access) ghcr.io/timeeval/arima python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
autoencoder ghcr.io/timeeval/autoencoder python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
bagel ghcr.io/timeeval/bagel python 3.7 ghcr.io/timeeval/python3-base semi-supervised univariate
baseline_increasing ghcr.io/timeeval/baseline_increasing Python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
baseline_normal ghcr.io/timeeval/baseline_normal Python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
baseline_random ghcr.io/timeeval/baseline_random Python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
cblof ghcr.io/timeeval/cblof python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
cof ghcr.io/timeeval/cof python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
copod ghcr.io/timeeval/copod python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
dae (DeNoising Autoencoder) ghcr.io/timeeval/dae python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
damp ghcr.io/timeeval/damp Python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
dbstream ghcr.io/timeeval/dbstream R 4.2.0 ghcr.io/timeeval/r4-base unsupervised multivariate
deepant ghcr.io/timeeval/deepant python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
deepnap ghcr.io/timeeval/deepnap python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
donut ghcr.io/timeeval/donut python 3.7 ghcr.io/timeeval/python3-base semi-supervised univariate
dspot ghcr.io/timeeval/dspot python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
dwt_mlead ghcr.io/timeeval/dwt_mlead python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
eif ghcr.io/timeeval/eif python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
encdec_ad ghcr.io/timeeval/encdec_ad python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
ensemble_gi ghcr.io/timeeval/ensemble_gi Python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
fast_mcd ghcr.io/timeeval/fast_mcd Python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
fft ghcr.io/timeeval/fft python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
generic_rf ghcr.io/timeeval/generic_rf python 3.7 ghcr.io/timeeval/python3-base semi-supervised univariate
generic_xgb ghcr.io/timeeval/generic_xgb python 3.7 ghcr.io/timeeval/python3-base semi-supervised univariate
grammarviz3 ghcr.io/timeeval/grammarviz3 Java ghcr.io/timeeval/java-base unsupervised univariate
grammarviz3_multi ghcr.io/timeeval/grammarviz3_multi Java ghcr.io/timeeval/java-base unsupervised multivariate
hbos ghcr.io/timeeval/hbos python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
health_esn ghcr.io/timeeval/health_esn Python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
hif ghcr.io/timeeval/hif python 3.7 ghcr.io/timeeval/python3-base supervised multivariate
hotsax ghcr.io/timeeval/hotsax python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
hybrid_knn ghcr.io/timeeval/hybrid_knn python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
if_lof ghcr.io/timeeval/if_lof python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
iforest ghcr.io/timeeval/iforest python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
img_embedding_cae ghcr.io/timeeval/img_embedding_cae python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised univariate
kmeans ghcr.io/timeeval/kmeans Python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
knn ghcr.io/timeeval/knn python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
laser_dbn ghcr.io/timeeval/laser_dbn Python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
left_stampi ghcr.io/timeeval/left_stampi Python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
lof ghcr.io/timeeval/lof python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
lstm_ad ghcr.io/timeeval/lstm_ad python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
lstm_vae ghcr.io/timeeval/lstm_vae python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised univariate
median_method ghcr.io/timeeval/median_method python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
mscred ghcr.io/timeeval/mscred python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
mstamp ghcr.io/timeeval/mstamp python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
mtad_gat ghcr.io/timeeval/mtad_gat python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
multi_hmm ghcr.io/timeeval/multi_hmm Python 3.7 ghcr.io/timeeval/python3-base supervised multivariate
multi_norma (restricted access) ghcr.io/timeeval/multi_norma Python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
multi_subsequence_lof ghcr.io/timeeval/multi_subsequence_lof python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
mvalmod ghcr.io/timeeval/mvalmod R 4.2.0 ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-base unsupervised multivariate
norma (restricted access) ghcr.io/timeeval/norma Python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
normalizing_flows ghcr.io/timeeval/normalizing_flows python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base supervised multivariate
novelty_svr ghcr.io/timeeval/novelty_svr python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
numenta_htm ghcr.io/timeeval/numenta_htm Python 2.7 ghcr.io/timeeval/python2-base unsupervised univariate
ocean_wnn ghcr.io/timeeval/ocean_wnn python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised univariate
omnianomaly ghcr.io/timeeval/omnianomaly Python 3.6 ghcr.io/timeeval/python36-base semi-supervised multivariate
pcc ghcr.io/timeeval/pcc Python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
pci ghcr.io/timeeval/pci Python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
phasespace_svm ghcr.io/timeeval/phasespace_svm python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
pst ghcr.io/timeeval/pst R 4.2.0 ghcr.io/timeeval/r4-base
random_black_forest ghcr.io/timeeval/random_black_forest python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
robust_pca ghcr.io/timeeval/robust_pca Python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
sand (restricted access) ghcr.io/timeeval/sand python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
sarima ghcr.io/timeeval/sarima python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
series2graph (restricted access) ghcr.io/timeeval/series2graph python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
s_h_esd ghcr.io/timeeval/s_h_esd python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
sr ghcr.io/timeeval/sr Python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
sr_cnn ghcr.io/timeeval/sr_cnn Python 3.7 ghcr.io/timeeval/python3-torch semi-supervised univariate
ssa (restricted access) ghcr.io/timeeval/ssa python 3.7 ghcr.io/timeeval/python3-base semi-supervised univariate
stamp ghcr.io/timeeval/stamp R 4.2.0 ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-base unsupervised univariate
stomp ghcr.io/timeeval/stomp R 4.2.0 ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-base unsupervised univariate
subsequence_fast_mcd ghcr.io/timeeval/subsequence_fast_mcd python 3.7 ghcr.io/timeeval/python3-base semi-supervised univariate
subsequence_knn ghcr.io/timeeval/subsequence_knn python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised multivariate
subsequence_if ghcr.io/timeeval/subsequence_if python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised univariate
subsequence_lof ghcr.io/timeeval/subsequence_lof python 3.7 ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-base unsupervised univariate
tanogan ghcr.io/timeeval/tanogan python 3.7 ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-base semi-supervised multivariate
tarzan ghcr.io/timeeval/tarzan Python 3.7 ghcr.io/timeeval/python3-torch semi-supervised univariate
telemanom ghcr.io/timeeval/telemanom python 3.7 ghcr.io/timeeval/python3-base semi-supervised multivariate
torsk ghcr.io/timeeval/torsk python 3.7 ghcr.io/timeeval/python3-base unsupervised multivariate
triple_es ghcr.io/timeeval/triple_es python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
ts_bitmap ghcr.io/timeeval/ts_bitmap python 3.7 ghcr.io/timeeval/python3-base unsupervised univariate
valmod ghcr.io/timeeval/valmod R 4.2.0 ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-base unsupervised univariate

Usage

Use the published algorithm images

Please always use a version-tagged Docker image for your algorithms to ensure reproducibility!

You can pull the TimeEval algorithm images directly from the GitHub registry. This registry does not require authentication.

docker pull ghcr.io/timeeval/<algorithm_name>:0.3.0

Build the algorithm images

Each algorithm in this repository is bundled in a self-contained Docker image so that it can be executed with a single command and no additional dependencies must be installed. This allows you to test the algorithm without installing its dependencies on your machine. The only requirement is a (x86-)Docker runtime.

In the following, we assume that you want to build the Docker image for the lof-algorithm.

⚠️ Use correct version tags!

Please tag the base and intermediate images with the correct version. You can find the required version for each algorithm image in its Dockerfile. E.g. for lof the version for pyod must be 0.3.0 (as of 2023-12-16):

FROM ghcr.io/timeeval/pyod:0.3.0

Prerequisites

You need the following tools installed on your development machine:

  • git
  • docker
  • access to this repository
  • (optionally) Docker BuildKit

Please make yourself familiar with the concepts of TimeEval, and read the TimeEval documentation and this document carefully!

1. Prepare base image

You'll need the required base Docker images to build your algorithm's image. You can either pull the base image from the registry or build it yourself. In this guide, we assume that you want to build all Docker images locally.

  1. Clone this repository and change to its root folder

    git clone https://github.com/TimeEval/TimeEval-algorithms.git
    cd TimeEval-algorithms
  2. Change to the 0-base-images folder:

    cd 0-base-images
  3. Build your desired base image:

    docker build -t ghcr.io/timeeval/python3-base:0.3.0 python3-base

Prepare intermediate image (optional)

Because the algorithm lof depends on an intermediate image, we, first, need to build the required intermediate image pyod. Please see the table in this repository's README for the dependencies.

You can build the intermediate image pyod using these commands:

cd ../1-intermediate-images
docker build -t ghcr.io/timeeval/pyod:0.2.5 pyod

Build algorithm image

Once you have built all dependent images, you can build your algorithm image from the base image(s):

  1. Change to the repository's root directory:

    cd ..
  2. Build the Docker image for your algorithm (lof in this case):

    docker build -t ghcr.io/timeeval/lof:0.3.0 ./lof

Testing an algorithm and its TimeEval integration

Testing an algorithm locally can be done in two different ways:

  1. Test the algorithm's code directly (using the tools provided by the programming language)
  2. Test the algorithm within its docker container

The first option is specific to the programming language, so we won't cover it here.

Each algorithm in this repository will be bundled in a self-contained Docker image so that it can be executed with a single command and no additional dependencies must be installed. This allows you to test the algorithm without installing its dependencies on your machine. The only requirement is a (x86-)Docker runtime. Follow the below steps to test your algorithm using Docker (examples assume that you want to build the image for the LOF algorithm):

  1. Pull or build the algorithm image We refer the reader to the previous section for detailed instructions.

  2. Train your algorithm (optional) If your algorithm is supervised or semi-supervised, execute the following command to perform the training step (not necessary for LOF):

    mkdir -p results
    docker run --rm \
        -v $(pwd)/data:/data:ro \
        -v $(pwd)/results:/results:rw \
    #    -e LOCAL_UID=<current user id> \
    #    -e LOCAL_GID=<current groupid> \
      ghcr.io/timeeval/<your_algorithm>:latest execute-algorithm '{
        "executionType": "train",
        "dataInput": "/data/dataset.csv",
        "dataOutput": "/results/anomaly_scores.ts",
        "modelInput": "/results/model.pkl",
        "modelOutput": "/results/model.pkl",
        "customParameters": {}
      }'

    Be warned that the result and model files will be written to the results-directory as the root-user if you do not pass the optional environment variables LOCAL_UID and LOCAL_GID to the container.

  3. Execute your algorithm Run the following command to perform the execution step of your algorithm:

    mkdir -p results
    TIMEEVAL_ALGORITHM=lof
    docker run --rm \
        -v $(pwd)/data:/data:ro \
        -v $(pwd)/results:/results:rw \
    #    -e LOCAL_UID=<current user id> \
    #    -e LOCAL_GID=<current groupid> \
      ghcr.io/timeeval/${TIMEEVAL_ALGORITHM}:latest execute-algorithm '{
        "executionType": "execute",
        "dataInput": "/data/dataset.csv",
        "dataOutput": "/results/anomaly_scores.ts",
        "modelInput": "/results/model.pkl",
        "modelOutput": "/results/model.pkl",
        "customParameters": {}
      }'

    Be warned that the result and model files will be written to the results-directory as the root-user if you do not pass the optional environment variables LOCAL_UID and LOCAL_GID to the container.