Skip to main content

Anomaly detection algorithm for time series datasets

Project description

Automated Online Sequential ESD (Python)

This package includes Python codes for online sequential ESD(osESD), a variation of GESD tests. It is a accurate and efficient way to detect anomalies in an univariate time series dataset.

We provide the basic function osESD and an automated grid search method auto-osESD. auto-osESD can be used to find the best parameters for a specific dataset,
using basic parameters or parameters provided explicitly by the user.

Installation

1. Download library.

Download osESD library using pip.

pip install osESD

2. Import function.

Import function in python code. osESD is for a single online sequential ESD test, and will return indices of the anomalies. Also, it will produce a text file with these anomalies in the designated output file (default 'osESD_results'). auto_osESD is for convenient tuning of osESD, and will run with default parameters if not specified otherwise.

from osESD import osESD, auto_osESD

3. Run on dataset.

Read data and run it using osESD. The model is designed to run on univarites time series dataset in a csv. fashion. Imported csv. dataset and custom name of the dataset should be entered. Also, the name of the column with values should be entered to 'value_name' and the name of the column with anomaly values should be entered as 'anomaly_name'.

import os
import pandas as pd

from osESD import osESD, auto_osESD

os.chdir(os.path.dirname(os.path.abspath(__file__)))

df = pd.read_csv("ARIMA1_ber_1.csv")
anoms_1 = osESD(df,"A2_benchmark", value_name='value',anomaly_name='anomaly')
print(anoms_1)

anoms_2 = osESD(df,"A2_benchmark", value_name='value',anomaly_name='anomaly',size=100, dwin=5, rwin=5, maxr=6, alpha=0.01)
print(anoms_2)

auto_anoms_1 = auto_osESD(df,"A2_benchmark_auto")
print(auto_anoms_1)

auto_anoms_2 = auto_osESD(df,"A2_benchmark_auto", size=[20,50,100,150],conditions=[True,False],alphas=[0.001,0.01],weights=[0,0,1,0],learning_length=0.3)
print(auto_anoms_2)

Versions

Python = 3.8.16    
argparse = 1.1  
numpy = 1.24.3  
pandas = 1.5.3  
torch = 1.13.1  
matplotlib = 3.7.0  
scikit-learn = 1.2.1  
scipy = 1.10.1  
rrcf = 0.4.4  

License

License :: OSI Approved :: MIT License
Operating System :: OS Independent

Acknowledgements

This work was supported by the Ministry of Education of the Republic of Korea 
and the National Research Foundation of Korea (NRF-2018R1A5A7059549). 
This work was also supported by `Human Resources Program in Energy Technology' 
of the Korea Institute of Energy, Technology Evaluation and Planning (KETEP), 
and was granted financial resources from the Ministry of Trade, 
Industry $\&$ Energy, Republic of Korea (No. 20204010600090).

Related research and tests were mainly done in 
Intelligent Data Systems Laboratory in Hanyang University, Seoul, South Korea.

References

Paper (currently under revision).

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

osesd-1.1.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

osESD-1.1.3-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file osesd-1.1.3.tar.gz.

File metadata

  • Download URL: osesd-1.1.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for osesd-1.1.3.tar.gz
Algorithm Hash digest
SHA256 d593be1cf287ac4d6804f8cf40286a5eee635837ca7ade3cb0820137591f6098
MD5 3547f83a9d6ceb318d035bf35b140ba0
BLAKE2b-256 2ec7f5defadfc86edf7b5a52e30ea0ecd9eb5723b268090bcbe306f28c5a568c

See more details on using hashes here.

File details

Details for the file osESD-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: osESD-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.13

File hashes

Hashes for osESD-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1e049d8ad409962dd0fbbd44e262f92be8dd8aa6d594b1ec49bd36ead038e393
MD5 77e3e406d34d78f500f7c41fd86b027f
BLAKE2b-256 ba537866a18b8a9c87738e9c22d51f69264667bf6dc08f64110492f8ae11cc3a

See more details on using hashes here.

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