Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
4fa5368
Merge pull request #10 from nlaptev/master
nlaptev Jun 20, 2015
c2e2bb3
Merge pull request #11 from nlaptev/master
nlaptev Jun 23, 2015
fedc46e
Update README.md
amizadeh Jun 26, 2015
86011a9
Update README.md
amizadeh Jun 26, 2015
0c9bfcf
Update README.md
amizadeh Jun 26, 2015
39c8190
Update README.md
amizadeh Jun 26, 2015
3dc4b80
Merge pull request #13 from nlaptev/master
nlaptev Jun 29, 2015
8a2369f
Merge pull request #14 from nlaptev/master
nlaptev Jun 30, 2015
8df6278
Merge pull request #15 from nlaptev/master
nlaptev Jul 1, 2015
8d17ce6
Merge pull request #16 from nlaptev/master
nlaptev Jul 2, 2015
275f3d2
test
Jul 17, 2015
a1fb1b0
Update README.md
amizadeh Aug 24, 2015
547362e
Merge branch 'master' of https://github.com/yahoo/egads
Sep 7, 2015
e0acfb3
Remove jar from scm, download through maven distribution.
Sep 18, 2015
fec7c05
Modified pom.xml due to compiler errors
Sep 20, 2015
eac48ad
Merge pull request #18 from lbordowitz/removeJar
nlaptev Sep 21, 2015
677e6e8
Update README.md
Oct 7, 2015
199f1d2
Merge pull request #19 from FlorianLautenschlager/patch-1
nlaptev Oct 7, 2015
2200dfa
updated README.md to set JAVA_HOME variable
varunagrawal Oct 9, 2015
b063b23
updated pom.xml to include maven compiler plugin to compiler egads
varunagrawal Oct 9, 2015
8d7f75e
Merge pull request #23 from varunagrawal/build
nlaptev Oct 12, 2015
8e2d88c
Fixed error in compiling due to an unknown dependency
Oct 13, 2015
5ef9d98
fix picking best model
kashif Dec 5, 2015
926187e
initial travis.yml
kashif Dec 5, 2015
abf93b6
Merge pull request #24 from kashif/patch-1
nlaptev Dec 6, 2015
634c76e
Merge pull request #25 from kashif/travis
nlaptev Dec 6, 2015
821e01b
added travis CI
Dec 8, 2015
c55a760
Added Travis CI status
Dec 8, 2015
b3ae536
Updated jdk to 8 for travis ci
Dec 8, 2015
3af331a
fixed some types, whitespace and added idea gitignore
Dec 14, 2015
ce6a38f
fixed formatting
Dec 14, 2015
f06d41c
Merge pull request #26 from kashif/typos
nlaptev Dec 15, 2015
e48b906
Updated readme
Dec 15, 2015
681da69
Fix TimeSeriesAbstractModel.betterThan()
karpada Mar 1, 2016
c435a2c
Merge pull request #29 from karpada/master
nlaptev Mar 4, 2016
1361dc9
Updating the path to the paper
markgrover Mar 30, 2016
adf94d0
Merge pull request #30 from markgrover/master
nlaptev Mar 30, 2016
0b0eee2
Added synthetic anomaly generation
jigs1993 Aug 19, 2016
843bfb6
Update README.md
KyleCoffin Oct 17, 2016
9dfda27
Merge pull request #34 from kylec-porch/patch-1
manolama Oct 26, 2016
489c2bc
Bump maven compilation version to 1.8 as Egads now uses Java 8
manolama Oct 27, 2016
595e9cf
Tweak the Travis build a bit.
manolama Oct 27, 2016
c08fc3a
Comment out the fat jar assembly for now. Will revisit with proper
manolama Nov 6, 2016
badd563
Fix issue 37: correct the model name in DoubleExponentialSmoothingMod…
skidder Jan 3, 2017
8cfa69d
Fix #36 by restoring the fat-jar assembly line. Thanks @sachinrase.
manolama Feb 1, 2017
c5fa8fd
Merge pull request #38 from skidder/fix-issue-37
manolama Mar 28, 2017
9deb0ad
Merge pull request #33 from jigs1993/master
manolama Apr 9, 2017
ec06aa5
Add the OlympicModel2 which is a calendar based period-over-period
manolama Apr 9, 2017
c850d62
Bump to version 0.2-SNAPSHOT
manolama Apr 9, 2017
a7abd29
Cleanup the pom a bit.
manolama Apr 9, 2017
3fee942
Fix the Bintray URL
manolama Apr 10, 2017
0c60acd
Still trying to get this to work with JCenter.
manolama Apr 10, 2017
f28be65
Cut a release 0.3.0
manolama Apr 10, 2017
bbe99f2
update to return anomalies as list
jigs1993 Aug 17, 2017
ed5ca8f
added test cases
jigs1993 Aug 17, 2017
1157882
adding license header
jigs1993 Aug 18, 2017
b401dcf
update to return anomalies as list (#43)
jigs1993 Aug 18, 2017
c7f8b5b
Bump to 0.3.1
manolama Aug 29, 2017
41ea47b
Feature: Specify detection window starttime in config
jigs1993 Nov 8, 2017
943c25f
Merge branch 'master' of https://github.com/yahoo/egads
jigs1993 Nov 8, 2017
7ca1ab2
Merge branch 'jigar-egads-branch'
jigs1993 Nov 8, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target/

*.iml
.idea/
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: java
addons:
hostname: short-hostname
jdk:
- oraclejdk8
notifications:
email: false
114 changes: 74 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,88 @@
[![Build Status](https://travis-ci.org/yahoo/egads.svg?branch=master)](https://travis-ci.org/yahoo/egads)

EGADS Java Library
===========================================================
==========================================================

EGADS (Extendible Generic Anomaly Detection System) is an open-source Java package to automatically detect anomalies in large scale time-series data.
EGADS is meant to be a library that contains a number of anomaly detection techniques applicable to many use-cases in a single package with the only dependency being Java.
EGADS works by first building a time-series model which is used to compute the expected value at time t. Then a number of errors E are computed by comparing the expected
value with the actual value at time t. EGADS automatically determines thresholds on E and outputs the most probable anomalies. EGADS library can be used in a wide
variety of contexts to detect outliers and change points in time-series that can have a various seasonal, trend and noise components.
EGADS (Extensible Generic Anomaly Detection System) is an open-source Java package to automatically detect anomalies in large scale time-series data.
EGADS is meant to be a library that contains a number of anomaly detection techniques applicable to many use-cases in a single package with the only dependency being Java.
EGADS works by first building a time-series model which is used to compute the expected value at time *t*. Then a number of errors *E* are computed by comparing the expected
value with the actual value at time *t*. EGADS automatically determines thresholds on *E* and outputs the most probable anomalies. EGADS library can be used in a wide
variety of contexts to detect outliers and change points in time-series that can have a various seasonal, trend and noise components.

How to get started
===========================

EGADS was designed as a self contained library that has a collection of time-series and anomaly detection models
that are applicable to a wide-range of use cases. To compile the library into a single jar, clone the repo and type the following:

`mvn clean compile assembly:single`
```shell
mvn clean compile assembly:single
```

You may have to set your `JAVA_HOME` variable to the appropriate JVM. To do this run:

```shell
export JAVA_HOME=/usr/lib/jvm/{JVM directory for desired version}
```

Usage
==========================

To run a simple example type:

`java -Dlog4j.configurationFile=src/test/resources/log4j2.xml -cp lib/OpenForecast-0.5.0.jar:target/egads-jar-with-dependencies.jar com.yahoo.egads.Egads src/test/resources/sample_config.ini src/test/resources/sample_input.csv`
```shell
java -Dlog4j.configurationFile=src/test/resources/log4j2.xml -cp target/egads-*-jar-with-dependencies.jar com.yahoo.egads.Egads src/test/resources/sample_config.ini src/test/resources/sample_input.csv
```

which produces the following picture (Note that you can enable this UI by setting `OUTPUT` config key to `GUI` in sample_config.ini).
which produces the following picture (Note that you can enable this UI by setting `OUTPUT` config key to `GUI` in `sample_config.ini`).

![gui](doc/ui.png "EGADS GUI")

One can also specify config parameters on a command line. For example to do anomaly detection using Olympic Scoring as a time-series model and a density based method as an anomaly detection model use the following.
One can also specify config parameters on a command line. For example to do anomaly detection using Olympic Scoring as a time-series model and a density based method as an anomaly detection model use the following.

`java -Dlog4j.configurationFile=src/test/resources/log4j2.xml -cp lib/OpenForecast-0.5.0.jar:target/egads-jar-with-dependencies.jar com.yahoo.egads.Egads "MAX_ANOMALY_TIME_AGO:999999999;AGGREGATION:1;OP_TYPE:DETECT_ANOMALY;TS_MODEL:OlympicModel;AD_MODEL:ExtremeLowDensityModel;INPUT:CSV;OUTPUT:STD_OUT;BASE_WINDOWS:168;PERIOD:-1;NUM_WEEKS:3;NUM_TO_DROP:0;DYNAMIC_PARAMETERS:0;TIME_SHIFTS:0" src/test/resources/sample_input.csv`
```shell
java -Dlog4j.configurationFile=src/test/resources/log4j2.xml -cp target/egads-*-jar-with-dependencies.jar com.yahoo.egads.Egads "MAX_ANOMALY_TIME_AGO:999999999;AGGREGATION:1;OP_TYPE:DETECT_ANOMALY;TS_MODEL:OlympicModel;AD_MODEL:ExtremeLowDensityModel;INPUT:CSV;OUTPUT:STD_OUT;BASE_WINDOWS:168;PERIOD:-1;NUM_WEEKS:3;NUM_TO_DROP:0;DYNAMIC_PARAMETERS:0;TIME_SHIFTS:0" src/test/resources/sample_input.csv
```

To run anomaly detection using no time-series model with an auto static threshold for anomaly detection, use the following:

`java -Dlog4j.configurationFile=src/test/resources/log4j2.xml -cp lib/OpenForecast-0.5.0.jar:target/egads-jar-with-dependencies.jar com.yahoo.egads.Egads "MAX_ANOMALY_TIME_AGO:999999999;AGGREGATION:1;OP_TYPE:DETECT_ANOMALY;TS_MODEL:NullModel;AD_MODEL:SimpleThresholdModel;SIMPLE_THRESHOLD_TYPE:AdaptiveMaxMinSigmaSensitivity;INPUT:CSV;OUTPUT:STD_OUT;AUTO_SENSITIVITY_ANOMALY_PCNT:0.2;AUTO_SENSITIVITY_SD:2.0" src/test/resources/sample_input.csv`
```shell
java -Dlog4j.configurationFile=src/test/resources/log4j2.xml -cp target/egads-*-jar-with-dependencies.jar com.yahoo.egads.Egads "MAX_ANOMALY_TIME_AGO:999999999;AGGREGATION:1;OP_TYPE:DETECT_ANOMALY;TS_MODEL:NullModel;AD_MODEL:SimpleThresholdModel;SIMPLE_THRESHOLD_TYPE:AdaptiveMaxMinSigmaSensitivity;INPUT:CSV;OUTPUT:STD_OUT;AUTO_SENSITIVITY_ANOMALY_PCNT:0.2;AUTO_SENSITIVITY_SD:2.0" src/test/resources/sample_input.csv
```

Overview
========
While rapid advances in computing hardware and software have led to powerful applications,
still hundreds of software bugs and hardware failures continue to happen in a large cluster
compromising user experience and subsequently revenue. Non-stop systems have a strict uptime
requirement and continuous monitoring of these systems is critical. From the data analysis point of view,
this means non-stop monitoring of large volume of time-series data in order to detect potential faults or anomalies.
Due to the large scale of the problem, human monitoring of this data is practically infeasible which leads us to
automated anomaly detection. An anomaly, or an outlier, is a data point which is significantly different from the rest of
While rapid advances in computing hardware and software have led to powerful applications,
still hundreds of software bugs and hardware failures continue to happen in a large cluster
compromising user experience and subsequently revenue. Non-stop systems have a strict uptime
requirement and continuous monitoring of these systems is critical. From the data analysis point of view,
this means non-stop monitoring of large volume of time-series data in order to detect potential faults or anomalies.
Due to the large scale of the problem, human monitoring of this data is practically infeasible which leads us to
automated anomaly detection. An anomaly, or an outlier, is a data point which is significantly different from the rest of
the data. Generally, the data in most applications is created by one or more generating processes that reflect the functionality of a system.

When the underlying generating process behaves in an unusual way, it creates outliers. Fast and efficient identification of these outliers is useful
When the underlying generating process behaves in an unusual way, it creates outliers. Fast and efficient identification of these outliers is useful
for many applications including: intrusion detection, credit card fraud, sensor events, medical diagnoses, law enforcement and others.
Current approaches in automated anomaly detection suffer from a large number of false positives which prohibit the usefulness of these systems in practice.
Use-case, or category specific, anomaly detection models may enjoy a low false positive rate for a specific application, but when the characteristics of
Current approaches in automated anomaly detection suffer from a large number of false positives which prohibit the usefulness of these systems in practice.
Use-case, or category specific, anomaly detection models may enjoy a low false positive rate for a specific application, but when the characteristics of
the time-series change, these techniques perform poorly without proper retraining.

EGADS (Extensible Generic Anomaly Detection System) enables the accurate and scalable detection of time-series
anomalies. EGADS separates forecasting and anomaly detection two separate components which allows the person to add her own models into any
of the components.
EGADS (Extensible Generic Anomaly Detection System) enables the accurate and scalable detection of time-series
anomalies. EGADS separates forecasting and anomaly detection two separate components which allows the person to add her own models into any
of the components.

Architecture
===========

The EGADS framework consists of two main components: the time-series modeling module (TMM), the anomaly detection module (ADM).
Given a time-series the TMM component models the time-series producing an expected value later consumed by the ADM that computes anomaly scores.
EGADS was built as a framework to be easily integrated into an existing monitoring infrastructure. At Yahoo,
our internal Yahoo Monitoring Service (YMS) processes millions of data-points every second. Therefore, having a scalable,
accurate and automated anomaly detection for YMS is critical. For this reason, EGADS can be compiled into a single light-weight jar and deployed easily at scale.
EGADS was built as a framework to be easily integrated into an existing monitoring infrastructure. At Yahoo,
our internal Yahoo Monitoring Service (YMS) processes millions of data-points every second. Therefore, having a scalable,
accurate and automated anomaly detection for YMS is critical. For this reason, EGADS can be compiled into a single light-weight jar and deployed easily at scale.

The TMM and ADM can be found under main/java/com/yahoo/egads/models.
The TMM and ADM can be found under `main/java/com/yahoo/egads/models`.

The example of the models supported by TMM and ADM can be found in in the two table below. We expect this colleciton of models to grow
The example of the models supported by TMM and ADM can be found in in the two table below. We expect this collection of models to grow
as more contribution is put forward by the community.

###### List of current TimeSeries Models
Expand All @@ -82,7 +98,7 @@ Configuration

Below are the various configuration parameters supported by EGADS.

````
```
# Only show anomalies no older than this.
# If this is set to 0, then only output an anomaly
# if it occurs on the last time-stamp.
Expand Down Expand Up @@ -216,35 +232,53 @@ WINDOW_SIZE 192

# FILTERING_METHOD specifies the filtering method for Spectral Smoothing
# Options: GAP_RATIO (Recommended: FILTERING_PARAM = 0.01)
# EIGEN_RATIO (Recommended: FILTERING_PARAM = 0.1)
# EXPLICIT (Recommended: FILTERING_PARAM = 10)
# K_GAP (Recommended: FILTERING_PARAM = 8)
# VARIANCE (Recommended: FILTERING_PARAM = 0.99)
# SMOOTHNESS (Recommended: FILTERING_PARAM = 0.97)
# EIGEN_RATIO (Recommended: FILTERING_PARAM = 0.1)
# EXPLICIT (Recommended: FILTERING_PARAM = 10)
# K_GAP (Recommended: FILTERING_PARAM = 8)
# VARIANCE (Recommended: FILTERING_PARAM = 0.99)
# SMOOTHNESS (Recommended: FILTERING_PARAM = 0.97)
FILTERING_METHOD GAP_RATIO

FILTERING_PARAM 0.01
````
```

Contributions
================

1. Clone your fork
2. Hack away
3. If you are adding new functionality, document it in the README
4. Verfiy your code by running `mvn package` and adding additional tests.
4. Verify your code by running `mvn package` and adding additional tests.
5. Push the branch up to GitHub
6. Send a pull request to the yahoo/egads project.

We actively welcome contributions. If you don't know where to start, try
checking out the [issue list](https://github.com/yahoo/egads/issues) and
fixing up the place. Or, you can add a model - a goal of this project
is to have a robust, lightweight and dependency-free set of models to choose from that are ready to
is to have a robust, lightweight and dependency-free set of models to choose from that are ready to
be deployed in production.

References
============
<a href="http://labs.yahoo.com/publication/generic-and-scalable-framework-for-automated-time-series-anomaly-detection/">Generic and Scalable Framework for Automated Time-series Anomaly Detection</a> by Nikolay Laptev, Saeed Amizadeh, Ian Flint , KDD 2015 (August 10, 2015)
<a href="https://s.yimg.com/ge/labs/v2/uploads/kdd2015.pdf">Generic and Scalable Framework for Automated Time-series Anomaly Detection</a> by Nikolay Laptev, Saeed Amizadeh, Ian Flint , KDD 2015 (August 10, 2015)

Citation
============
If you use EGADS in your projects, please cite:
<a href="https://s.yimg.com/ge/labs/v2/uploads/kdd2015.pdf">Generic and Scalable Framework for Automated Time-series Anomaly Detection</a> by Nikolay Laptev, Saeed Amizadeh, Ian Flint , KDD 2015

BibTeX:

```tex
@inproceedings{laptev2015generic,
title={Generic and Scalable Framework for Automated Time-series Anomaly Detection},
author={Laptev, Nikolay and Amizadeh, Saeed and Flint, Ian},
booktitle={Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining},
pages={1939--1947},
year={2015},
organization={ACM}
}
```

License
=======
Expand Down
Binary file removed lib/OpenForecast-0.5.0.jar
Binary file not shown.
40 changes: 40 additions & 0 deletions lib/Synthetic_Anomalies/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# --- Use real time-series or New synthetic time-series ---
# use real(input) 0
# genrerate new 1
OUTPUT_FORMAT = 1

# --- Seasonality type ---
# Only for OUTPUT_FORMAT = 1
# daily 0
# weekly 1

S_TYPE = 1

# --- Number of weeks ---
# enter number of weeks you want in output time-series here(maximum 52),

NUM_WEEKS = 4

# --- Type of anomaly ---
# Point anomaly(sudden change) 0
# Contextual anomaly(gradual incease or desrease with time) 1
# Anomalous behaviour 2

A_TYPE = 2

# --- Frequency of anomaly ---
# enter the probability value that represents frequency of anomalies in data
# For A_TYPE = 1 and 2, Frequncy value applies for second half of time-series because first half should act as a reference to normal time-series

FREQUENCY = 0.5

# --- Severity of anomaly ---
# enter the severity amount(0 to 1, 0 being very less sever to 1 being very high sever) of anomaly
# less sever means less variation from normal values: hard to detect
# highly sever means high variation from normal values: easy to detect
# In terms of standard deviation(s.d.):
# 0 ---> 0% deviation in data(pure smoothed time-series)
# 0.5 ---> 100% deviation in data in the case of anomaly
# 1.0 ---> 200% deviation in data in the case of anomaly
# for rest of the values between 0 to 1 it scales linearly as per the above interval values
SEVERITY = 0.5
Loading