Home

Awesome

<div align="center"> <img width="130px" src="./timeeval-algorithms.png" alt="TimeEval logo"/> <h1 align="center">TimeEval Algorithms</h1> <p> Time Series Anomaly Detection Algorithms for TimeEval. </p> </div>

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)ImageLanguageBase imageLearning TypeInput Dimensionality
arima (restricted access)ghcr.io/timeeval/arimapython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
autoencoderghcr.io/timeeval/autoencoderpython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
bagelghcr.io/timeeval/bagelpython 3.7ghcr.io/timeeval/python3-basesemi-supervisedunivariate
baseline_increasingghcr.io/timeeval/baseline_increasingPython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
baseline_normalghcr.io/timeeval/baseline_normalPython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
baseline_randomghcr.io/timeeval/baseline_randomPython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
cblofghcr.io/timeeval/cblofpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
cofghcr.io/timeeval/cofpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
copodghcr.io/timeeval/copodpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
dae (DeNoising Autoencoder)ghcr.io/timeeval/daepython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
dampghcr.io/timeeval/dampPython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
dbstreamghcr.io/timeeval/dbstreamR 4.2.0ghcr.io/timeeval/r4-baseunsupervisedmultivariate
deepantghcr.io/timeeval/deepantpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
deepnapghcr.io/timeeval/deepnappython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
donutghcr.io/timeeval/donutpython 3.7ghcr.io/timeeval/python3-basesemi-supervisedunivariate
dspotghcr.io/timeeval/dspotpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
dwt_mleadghcr.io/timeeval/dwt_mleadpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
eifghcr.io/timeeval/eifpython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
encdec_adghcr.io/timeeval/encdec_adpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
ensemble_gighcr.io/timeeval/ensemble_giPython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
fast_mcdghcr.io/timeeval/fast_mcdPython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
fftghcr.io/timeeval/fftpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
generic_rfghcr.io/timeeval/generic_rfpython 3.7ghcr.io/timeeval/python3-basesemi-supervisedunivariate
generic_xgbghcr.io/timeeval/generic_xgbpython 3.7ghcr.io/timeeval/python3-basesemi-supervisedunivariate
grammarviz3ghcr.io/timeeval/grammarviz3Javaghcr.io/timeeval/java-baseunsupervisedunivariate
grammarviz3_multighcr.io/timeeval/grammarviz3_multiJavaghcr.io/timeeval/java-baseunsupervisedmultivariate
hbosghcr.io/timeeval/hbospython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
health_esnghcr.io/timeeval/health_esnPython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
hifghcr.io/timeeval/hifpython 3.7ghcr.io/timeeval/python3-basesupervisedmultivariate
hotsaxghcr.io/timeeval/hotsaxpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
hybrid_knnghcr.io/timeeval/hybrid_knnpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
if_lofghcr.io/timeeval/if_lofpython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
iforestghcr.io/timeeval/iforestpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
img_embedding_caeghcr.io/timeeval/img_embedding_caepython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedunivariate
kmeansghcr.io/timeeval/kmeansPython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
knnghcr.io/timeeval/knnpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
laser_dbnghcr.io/timeeval/laser_dbnPython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
left_stampighcr.io/timeeval/left_stampiPython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
lofghcr.io/timeeval/lofpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
lstm_adghcr.io/timeeval/lstm_adpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
lstm_vaeghcr.io/timeeval/lstm_vaepython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedunivariate
median_methodghcr.io/timeeval/median_methodpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
mscredghcr.io/timeeval/mscredpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
mstampghcr.io/timeeval/mstamppython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
mtad_gatghcr.io/timeeval/mtad_gatpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
multi_hmmghcr.io/timeeval/multi_hmmPython 3.7ghcr.io/timeeval/python3-basesupervisedmultivariate
multi_norma (restricted access)ghcr.io/timeeval/multi_normaPython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
multi_subsequence_lofghcr.io/timeeval/multi_subsequence_lofpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
mvalmodghcr.io/timeeval/mvalmodR 4.2.0ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-baseunsupervisedmultivariate
norma (restricted access)ghcr.io/timeeval/normaPython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
normalizing_flowsghcr.io/timeeval/normalizing_flowspython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesupervisedmultivariate
novelty_svrghcr.io/timeeval/novelty_svrpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
numenta_htmghcr.io/timeeval/numenta_htmPython 2.7ghcr.io/timeeval/python2-baseunsupervisedunivariate
ocean_wnnghcr.io/timeeval/ocean_wnnpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedunivariate
omnianomalyghcr.io/timeeval/omnianomalyPython 3.6ghcr.io/timeeval/python36-basesemi-supervisedmultivariate
pccghcr.io/timeeval/pccPython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
pcighcr.io/timeeval/pciPython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
phasespace_svmghcr.io/timeeval/phasespace_svmpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
pstghcr.io/timeeval/pstR 4.2.0ghcr.io/timeeval/r4-base
random_black_forestghcr.io/timeeval/random_black_forestpython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
robust_pcaghcr.io/timeeval/robust_pcaPython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
sand (restricted access)ghcr.io/timeeval/sandpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
sarimaghcr.io/timeeval/sarimapython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
series2graph (restricted access)ghcr.io/timeeval/series2graphpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
s_h_esdghcr.io/timeeval/s_h_esdpython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
srghcr.io/timeeval/srPython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
sr_cnnghcr.io/timeeval/sr_cnnPython 3.7ghcr.io/timeeval/python3-torchsemi-supervisedunivariate
ssa (restricted access)ghcr.io/timeeval/ssapython 3.7ghcr.io/timeeval/python3-basesemi-supervisedunivariate
stampghcr.io/timeeval/stampR 4.2.0ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-baseunsupervisedunivariate
stompghcr.io/timeeval/stompR 4.2.0ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-baseunsupervisedunivariate
subsequence_fast_mcdghcr.io/timeeval/subsequence_fast_mcdpython 3.7ghcr.io/timeeval/python3-basesemi-supervisedunivariate
subsequence_knnghcr.io/timeeval/subsequence_knnpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedmultivariate
subsequence_ifghcr.io/timeeval/subsequence_ifpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedunivariate
subsequence_lofghcr.io/timeeval/subsequence_lofpython 3.7ghcr.io/timeeval/pyod -> ghcr.io/timeeval/python3-baseunsupervisedunivariate
tanoganghcr.io/timeeval/tanoganpython 3.7ghcr.io/timeeval/python3-torch -> ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
tarzanghcr.io/timeeval/tarzanPython 3.7ghcr.io/timeeval/python3-torchsemi-supervisedunivariate
telemanomghcr.io/timeeval/telemanompython 3.7ghcr.io/timeeval/python3-basesemi-supervisedmultivariate
torskghcr.io/timeeval/torskpython 3.7ghcr.io/timeeval/python3-baseunsupervisedmultivariate
triple_esghcr.io/timeeval/triple_espython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
ts_bitmapghcr.io/timeeval/ts_bitmappython 3.7ghcr.io/timeeval/python3-baseunsupervisedunivariate
valmodghcr.io/timeeval/valmodR 4.2.0ghcr.io/timeeval/tsmp -> ghcr.io/timeeval/r4-baseunsupervisedunivariate

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.

:warning: 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:

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.