Skip to main content

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).

Metadata

Release files for anomalearn 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anomalearn 0.0.2
File Size Uploaded Provenance
anomalearn-0.0.2.tar.gz 93.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for anomalearn 0.0.2
File Interpreter ABI Platform
anomalearn-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 241.9 kB

Release files / anomalearn-0.0.2.tar.gz

Download URL anomalearn-0.0.2.tar.gz
Size 93.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0648540f9c46328cd26d81979b3fb1799d2757c6723fc6c8fa01216985987560
BLAKE2b-256 checksum
How to use checksums
f8ae6b081d6806619449b4f94268c2fe3407dd885e99055d45c6c0b42a0e159c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.11.1 Windows/10

Release files / anomalearn-0.0.2-py3-none-any.whl

Download URL anomalearn-0.0.2-py3-none-any.whl
Size 148.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
735efc7014c1fbee490a3ea48ce762adeee63c70615f15f0f6f82204702f3b8a
BLAKE2b-256 checksum
How to use checksums
25c7c07ec0119b73d2967a8e073c9dd87c8f18edc75eb4e9f88ddf8b4c4d566e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.11.1 Windows/10

Security for anomalearn 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page