Skip to main content

A modular and extensible end-to-end library for time series anomaly detection

Project description

anomalearn: time series anomaly detection library

Group Badges
PyPI PyPI PyPI - Status PyPI - Format PyPI - Python Version PyPI - License
Repository Maintenance
Code linting: pycodestyle linting: flake8 linting: pylint Imports: isort
Docstrings NumpyDoc

Status

The current version of the library (first version) is a pre-release because other content is planned to be added, i.e., the library is currently on development. However, we feel that people can start to use it and contribute to it. Please refer to the documentation for contribution and use.

What is it?

anomalearn is a Python package that provides modular and extensible functionalities for developing anomaly detection methods for time series data, reading publicly available time series anomaly detection datasets, creating the loading of data for experiments, and dataset evaluation functions. Additionally, anomalearn development's plans include the implementation of several state-of-the-art and historical anomaly detection methods, and the implementation of objects to automate the training process of methods. See Discussion and development section for more details.

Documentation

Every functionality in anomalearn is documented. The official documentation is hosted at https://marcopetri98.github.io/anomalearn/index.html.

Main features

Here you find a list of the features offered by anomalearn:

  • Implementation of state-of-the-art and historical anomaly detection methods for time series. The bare models are located in anomalearn.algorithms.models. Where bare models mean the model without the preprocessing or postprocessing operations.
  • Implementation of data readers of commonly used publicly accessible time series anomaly detection datasets. Data readers are all located in the package anomalearn.reader or in anomalearn.reader.time_series. All data readers return a pandas DataFrame.
  • Implementation of some data analysis functions, such as simplicity scoring functions, stationarity tests and time series decomposition functions. These functions are all located in anomalearn.analysis.
  • Implementation of helpers for creating experiments. Currently, only the helper for data loading has been implemented capable of taking data readers and returning all or a subset of series with a default or specific split. The experiment helpers are all located in anomalearn.applications.

Installation

The source code is available at anomalearn github repo.

Currently, the library is shipped only to the Python Package Index (PyPI).

# install from PyPI
pip install anomalearn --pre

Installation from source

Firstly, download or clone the repository and place it in any location on your computer. We will call REPO_PATH. Open the terminal and navigate to the folder:

cd REPO_PATH

Secondly, install the repository using pip:

pip install .

Dependencies

This repository is strongly based on other existing high-quality Python packages for machine learning and for general programming:

  • Numpy: adds support for efficient array operations.
  • Scipy: adds support for scientific computing.
  • Numba: adds a Just In Time compiler for functions that have to be efficient and leaves the package a pure Python package.
  • Pandas: adds support for working with data structures.
  • Scikit-learn: adds support for model development.
  • Scikit-optimize: adds support for searching hyper-parameters of models.
  • Statsmodels: adds support for statistical tests and models.
  • Matplotlib: adds supports for plotting.

Getting help

For the moment, the suggested way to get help is by posting questions to StackOverflow. Then, until the community will grow bigger, consider sending the URL of the questions to the author via email.

Background

This work started with Marco Petri's thesis work. The work initially aimed to develop new anomaly detection methods for time series to reach new state-of-the-art performances. However, given the scarcity of tools specifically aimed for time series anomaly detection, the thesis developed anomalearn and a way to evaluate the simplicity of a dataset. The very first version of the library (v0.0.2a1) is the one presented and described on the thesis. From that point on, the library will receive updates outside the sole scope of the thesis.

Discussion and development

Currently, the development of the first stable version of anomalearn is ongoing. If you want to use it, you can help us in testing the functionalities by providing feedback on the clarity of the documentation, the naming of functions, ease of use, and in proposing new functionalities to implement.

In the future, once the first stable version will be published, a structured and well documented on how to contribute to the library will be written. For the moment, all the discussions related to the development, requests and proposals should be places in the GitHub discussion page.

Contributing to code

Firstly, download or clone the repository and place it in any location on your computer. We will call REPO_PATH. Open the terminal and navigate to the folder:

cd REPO_PATH

The library uses poetry for managing dependencies, building, and publishing. Therefore, it is strongly recommended to carefully read its docs to be able to contribute and install it from source. Be careful, the installed version of poetry must be at least 1.4.1.

poetry init

Now, poetry will recognize the project. You can install the library and its dependencies by using the poetry lock file such that every contributor will use the exact same versions of packages:

# this command will install the library using the lock file
poetry install

Now, you can add functionalities to the library. To ask for changes to be merged, create a pull request. However, it is strongly suggested to ask if a feature can be implemented in anomalearn such that it does not violate any design choice.

Citation

Currently, neither the thesis has been published nor a paper presenting the library to a conference or in a journal has been published. I strongly ask you to wait till the 4th of May 2023 to get the citation (the date on which the dissertation will happen and the thesis will be published).

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

anomalearn-0.0.2.tar.gz (93.1 kB view details)

Uploaded Source

Built Distribution

anomalearn-0.0.2-py3-none-any.whl (148.8 kB view details)

Uploaded Python 3

File details

Details for the file anomalearn-0.0.2.tar.gz.

File metadata

  • Download URL: anomalearn-0.0.2.tar.gz
  • Upload date:
  • Size: 93.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.11.1 Windows/10

File hashes

Hashes for anomalearn-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0648540f9c46328cd26d81979b3fb1799d2757c6723fc6c8fa01216985987560
MD5 2b56174f9bf9f85173d5cdb304891f4c
BLAKE2b-256 f8ae6b081d6806619449b4f94268c2fe3407dd885e99055d45c6c0b42a0e159c

See more details on using hashes here.

File details

Details for the file anomalearn-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: anomalearn-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 148.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.11.1 Windows/10

File hashes

Hashes for anomalearn-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 735efc7014c1fbee490a3ea48ce762adeee63c70615f15f0f6f82204702f3b8a
MD5 6aeec8ad0dd396bc6fd84304e8ddecf3
BLAKE2b-256 25c7c07ec0119b73d2967a8e073c9dd87c8f18edc75eb4e9f88ddf8b4c4d566e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page