All Projects → KDD-OpenSource → Deepadots

KDD-OpenSource / Deepadots

Licence: mit
Repository of the paper "A Systematic Evaluation of Deep Anomaly Detection Methods for Time Series".

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Deepadots

Ad examples
A collection of anomaly detection methods (iid/point-based, graph and time series) including active learning for anomaly detection/discovery, bayesian rule-mining, description for diversity/explanation/interpretability. Analysis of incorporating label feedback with ensemble and tree-based detectors. Includes adversarial attacks with Graph Convolutional Network.
Stars: ✭ 641 (+91.34%)
Mutual labels:  time-series, timeseries, anomaly-detection
singular-spectrum-transformation
fast implementation of singular spectrum transformation (change point detection algorithm)
Stars: ✭ 41 (-87.76%)
Mutual labels:  time-series, anomaly-detection
cnosdb
An Open Source Distributed Time Series Database with high performance, high compression ratio and high usability.
Stars: ✭ 858 (+156.12%)
Mutual labels:  timeseries, time-series
Skyline
Anomaly detection
Stars: ✭ 303 (-9.55%)
Mutual labels:  timeseries, anomaly-detection
modeltime.ensemble
Time Series Ensemble Forecasting
Stars: ✭ 65 (-80.6%)
Mutual labels:  timeseries, time-series
tempo
API for manipulating time series on top of Apache Spark: lagged time values, rolling statistics (mean, avg, sum, count, etc), AS OF joins, downsampling, and interpolation
Stars: ✭ 212 (-36.72%)
Mutual labels:  timeseries, time-series
mvts-ano-eval
A repository for code accompanying the manuscript 'An Evaluation of Anomaly Detection and Diagnosis in Multivariate Time Series' (published at TNNLS)
Stars: ✭ 26 (-92.24%)
Mutual labels:  time-series, anomaly-detection
Deep XF
Package towards building Explainable Forecasting and Nowcasting Models with State-of-the-art Deep Neural Networks and Dynamic Factor Model on Time Series data sets with single line of code. Also, provides utilify facility for time-series signal similarities matching, and removing noise from timeseries signals.
Stars: ✭ 83 (-75.22%)
Mutual labels:  timeseries, time-series
mtad-gat-pytorch
PyTorch implementation of MTAD-GAT (Multivariate Time-Series Anomaly Detection via Graph Attention Networks) by Zhao et. al (2020, https://arxiv.org/abs/2009.02040).
Stars: ✭ 85 (-74.63%)
Mutual labels:  time-series, anomaly-detection
khiva-ruby
High-performance time series algorithms for Ruby
Stars: ✭ 27 (-91.94%)
Mutual labels:  time-series, anomaly-detection
Merlion
Merlion: A Machine Learning Framework for Time Series Intelligence
Stars: ✭ 2,368 (+606.87%)
Mutual labels:  time-series, anomaly-detection
Hastic Server
Hastic data management server for analyzing patterns and anomalies from Grafana
Stars: ✭ 292 (-12.84%)
Mutual labels:  timeseries, anomaly-detection
microprediction
If you can measure it, consider it predicted
Stars: ✭ 158 (-52.84%)
Mutual labels:  timeseries, time-series
downsample
Collection of several downsampling methods for time series visualisation purposes.
Stars: ✭ 50 (-85.07%)
Mutual labels:  timeseries, time-series
sherlock
Sherlock is an anomaly detection service built on top of Druid
Stars: ✭ 137 (-59.1%)
Mutual labels:  timeseries, anomaly-detection
awesome-time-series
Resources for working with time series and sequence data
Stars: ✭ 178 (-46.87%)
Mutual labels:  time-series, anomaly-detection
Pycaret
An open-source, low-code machine learning library in Python
Stars: ✭ 4,594 (+1271.34%)
Mutual labels:  time-series, anomaly-detection
timemachines
Predict time-series with one line of code.
Stars: ✭ 342 (+2.09%)
Mutual labels:  timeseries, time-series
msda
Library for multi-dimensional, multi-sensor, uni/multivariate time series data analysis, unsupervised feature selection, unsupervised deep anomaly detection, and prototype of explainable AI for anomaly detector
Stars: ✭ 80 (-76.12%)
Mutual labels:  time-series, anomaly-detection
Hurst-exponent-R-S-analysis-
Calculates the Hurst exponent of a time series based on Rescaled range (R/S) analysis.
Stars: ✭ 33 (-90.15%)
Mutual labels:  timeseries, time-series

Anomaly Detection on Time Series: An Evaluation of Deep Learning Methods. CircleCI

The goal of this repository is to provide a benchmarking pipeline for anomaly detection on time series data for multiple state-of-the-art deep learning methods.

Implemented Algorithms

Name Paper
LSTM-AD Long short term memory networks for anomaly detection in time series, ESANN 2015
LSTM-ED LSTM-based encoder-decoder for multi-sensor anomaly detection, ICML 2016
Autoencoder Outlier detection using replicator neural networks, DaWaK 2002
Donut Unsupervised Anomaly Detection via Variational Auto-Encoder for Seasonal KPIs in Web Applications, WWW 2018
REBM Deep structured energy based models for anomaly detection, ICML 2016
DAGMM Deep autoencoding gaussian mixture model for unsupervised anomaly detection, ICLR 2018
LSTM-DAGMM Extension of DAGMM using an LSTM-Autoencoder instead of a Neural Network Autoencoder

Usage

git clone git://github.com/KDD-OpenSource/DeepADoTS.git  
virtualenv venv -p /usr/bin/python3  
source venv/bin/activate  
pip install -r requirements.txt  
python3 main.py

Example

We follow the scikit-learn API by offering the interface methods fit(X) and predict(X). The former estimates the data distribution in an unsupervised way while the latter returns an anomaly score for each instance - the higher, the more certain is the model that the instance is an anomaly. To compare the performance of methods, we use the ROC AUC value.

We use MNIST to demonstrate the usage of a model since it is already available in TensorFlow and does not require downloading external data (even though the data has no temporal aspect).

import pandas as pd
import tensorflow as tf
from sklearn.metrics import roc_auc_score

from src.algorithms import AutoEncoder
from src.datasets import Dataset


class MNIST(Dataset):
    """0 is the outlier class. The training set is free of outliers."""

    def __init__(self, seed):
        super().__init__(name="MNIST", file_name='')  # We do not need to load data from a file
        self.seed = seed

    def load(self):
        # 0 is the outlier, all other digits are normal
        OUTLIER_CLASS = 0
        mnist = tf.keras.datasets.mnist
        (x_train, y_train), (x_test, y_test) = mnist.load_data()
        # Label outliers with 1 and normal digits with 0
        y_train, y_test = (y_train == OUTLIER_CLASS), (y_test == OUTLIER_CLASS)
        x_train = x_train[~y_train]  # Remove outliers from the training set
        x_train, x_test = x_train / 255, x_test / 255
        x_train, x_test = x_train.reshape(-1, 784), x_test.reshape(-1, 784)
        self._data = tuple(pd.DataFrame(data=data) for data in [x_train, y_train, x_test, y_test])


x_train, y_train, x_test, y_test = MNIST(seed=0).data()
# Use fewer instances for demonstration purposes
x_train, y_train = x_train[:1000], y_train[:1000]
x_test, y_test = x_test[:100], y_test[:100]

model = AutoEncoder(sequence_length=1, num_epochs=40, hidden_size=10, lr=1e-4)
model.fit(x_train)

error = model.predict(x_test)
print(roc_auc_score(y_test, error))  # e.g. 0.8614

We can visualize the samples with respective error values as follows

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import offsetbox

"""Borrowed from https://github.com/scikit-learn/scikit-learn/blob/master/examples/manifold/plot_lle_digits.py#L44"""
error = (error - error.min()) / (error.max() - error.min())  # Normalize error
x_test = x_test.values
y_random = np.random.rand(len(x_test)) * 2 - 1
plt.figure(figsize=(20, 10))
ax = plt.subplot(111)
if hasattr(offsetbox, 'AnnotationBbox'):
    shown_images = np.array([[1., 1.]])
    for i in range(len(x_test)):
        X_instance = [error[i], y_random[i]]
        dist = np.sum((X_instance - shown_images) ** 2, 1)
        if np.min(dist) < 4e-5:
            # don't show points that are too close
            continue
        shown_images = np.r_[shown_images, [X_instance]]
        imagebox = offsetbox.AnnotationBbox(offsetbox.OffsetImage(x_test[i].reshape(28, 28), cmap=plt.cm.gray_r), X_instance)
        ax.add_artist(imagebox)
plt.xlim((0, 1.1))
plt.ylim((-1.2, 1.2))
plt.xlabel("Anomaly Score")
plt.title("Predicted Anomaly Score for the Test Set")
plt.show()

Which creates a plot like this We can see that global outliers (zeros) and local outliers (strangely written digits) receive high anomaly scores.

Deployment

  • docker build -t deep-adots .
  • docker run -ti deep-adots /bin/bash -c "python3.6 /repo/main.py"

Authors/Contributors

Team:

Supervisors:

Credits

Base implementation for DAGMM
Base implementation for Donut
Base implementation for Recurrent EBM
Downloader for real-world datasets

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].