Skip to main content

Librería para evaluación de detección de anomalías en series temporales

Project description

TSADmetrics - Time Series Anomaly Detection Metrics

TSADmetrics is a Python library for evaluating anomaly detection algorithms in time series data.
It provides a comprehensive set of metrics specifically designed to handle the temporal nature of anomalies.


Key features

  • Metric Taxonomy: Metrics are categorized into types based on how they handle temporal context:

    • SPM Metrics: Evaluate predictions at each point independently, ignoring temporal continuity.
    • TEM Metrics: Consider temporal context, analyzing when and how anomalies occur.
      • TPDM: Partial detection within a real anomaly event counts as correct.
      • PTDM: Requires detection to cover a significant fraction of the real anomaly.
      • TMEM: Measures alignment of real vs predicted anomaly events.
      • DPM: Penalizes late detections.
      • TSTM: Allows temporal tolerance for early or late detections.
  • Direct Metric Usage: Instantiate any metric class and call compute() for individual evaluation.

  • Batch Evaluation: Use Runner to evaluate multiple datasets and metrics at once, with support for both direct data and CSV/JSON input.

  • Flexible Configuration: Load metrics from YAML configuration files or global evaluation config files.


Getting the library

The project can be download in this repository. Detailed information about getting and running the library can be consulted in user’s manual where all dependencies and libraries necessaries are commented.


Installation

Install TSADmetrics via pip:

pip install tsadmetrics

Tutorials and documentation

The complete documentation for TSADmetrics is available at:
📚 https://tsadmetrics.readthedocs.io/

User's manual can be found in the main directory documentation of this repository and includes:

  • Getting and installing the library.
  • A description of library architecture.
  • Run metrics in the library.
  • Add new metrics in the library.
  • API reference.

Metric included

TSADmetrics includes 34 metrics, organized according to the proposed taxonomy for time series anomaly detection metrics.

Category Subcategory Metric
SPM PointwiseFScore
SPM DiceCoefficient
SPM PointwiseAucRoc
SPM PointwiseAucPr
SPM PrecisionAtK
TEM TPDM PointadjustedFScore
TEM TPDM BalancedPointadjustedFScore
TEM TPDM SegmentwiseFScore
TEM TPDM CompositeFScore
TEM TPDM PointadjustedAucPr
TEM TPDM PointadjustedAucRoc
TEM TPDM RangebasedFScore
TEM DPM DelayThresholdedPointadjustedFScore
TEM DPM EarlyDetectionScore
TEM DPM LatencySparsityawareFScore
TEM DPM MeanTimeToDetect
TEM DPM NabScore
TEM PTDM AverageDetectionCount
TEM PTDM TotalDetectedInRange
TEM PTDM DetectionAccuracyInRange
TEM PTDM WeightedDetectionDifference
TEM PTDM PointadjustedAtKFScore
TEM PTDM PointadjustedAtKLFScore
TEM PTDM TimeseriesAwareFScore
TEM TMEM AbsoluteDetectionDistance
TEM TMEM EnhancedTimeseriesAwareFScore
TEM TMEM TemporalDistance
TEM TSTM AffiliationbasedFScore
TEM TSTM NormalizedAffiliationbasedFScore
TEM TSTM PateFScore
TEM TSTM Pate
TEM TSTM TimeTolerantFScore
TEM TSTM VusRoc
TEM TSTM VusPr

Acknowledgements

This library was supported in part by the PID2023-148396NB-I00 project of Spanish Ministry of Science and Innovation and the European Regional Development Fund, by the ProyExcel-0069 project of the Andalusian University, Research and Innovation Department.

Citation

<>

References

This library is based on the concepts and implementations from:
Sørbø, S., & Ruocco, M. (2023). Navigating the metric maze: a taxonomy of evaluation metrics for anomaly detection in time series. https://doi.org/10.1007/s10618-023-00988-8

Licence

The tools is free and open source, under the GNU General Public GPLv3 license.

Reporting bugs

Feel free to open an issue at Github if anything is not working as expected. Merge request are also encouraged, it will be carefully reviewed and merged if everything is all right.

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

tsadmetrics-1.0.12.tar.gz (104.9 kB view details)

Uploaded Source

Built Distribution

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

tsadmetrics-1.0.12-py3-none-any.whl (120.6 kB view details)

Uploaded Python 3

File details

Details for the file tsadmetrics-1.0.12.tar.gz.

File metadata

  • Download URL: tsadmetrics-1.0.12.tar.gz
  • Upload date:
  • Size: 104.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tsadmetrics-1.0.12.tar.gz
Algorithm Hash digest
SHA256 488a24e36c4a9b07cad9ef5182bd9db2b5ef9ef046e8e2006163041a9eb50a4d
MD5 9116fbe3cebabf0910cf057394eb80fe
BLAKE2b-256 1d72e9a239091f47859c0882c4698a798d6d06bb06795592f5e306b9d7a64a5e

See more details on using hashes here.

File details

Details for the file tsadmetrics-1.0.12-py3-none-any.whl.

File metadata

  • Download URL: tsadmetrics-1.0.12-py3-none-any.whl
  • Upload date:
  • Size: 120.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tsadmetrics-1.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 97f87a8dbb557cdea610c4a4a244cfb809c6a890827197dc9b4c06b613fd99d3
MD5 6c31a7fe8f1498a3f8c4c9c6fcf7a7ba
BLAKE2b-256 a3d8d8ae1be6fa4e25cb64abf15b08c5d198fc11c6a310afef53a761f611e44d

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