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. These metrics are organized into a taxonomy according to the temporal characteristics they evaluate, including point-wise performance, event coverage, temporal alignment, detection delay, and tolerance to temporal shifts. A detailed description is available in the Metric taxonomy section of the online documentation.
This is the official source repository for the TSADmetrics Python package described in our Neurocomputing paper.
Key features
-
Metric Taxonomy: Metrics are categorized into types based on how they handle temporal context:
- Single-Point-based Metrics (SPM): Evaluate predictions at each point independently, ignoring temporal continuity.
- Temporal Evaluation Metrics (TEM): Consider temporal context, analyzing when and how anomalies occur.
- Tolerant Partial Detection Metrics (TPDM): Partial detection within a real anomaly event counts as correct.
- Precise Temporal Detection Metrics (PTDM): Requires detection to cover a significant fraction of the real anomaly.
- Temporal Matching Evaluation Metrics (TMEM): Measures alignment of real vs predicted anomaly events.
- Delay-Penalized Metrics (DPM): Penalizes late detections.
- Temporal Shift-Tolerant Metrics (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
Runnerto 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
TSADmetrics is available on PyPI. If you manage your project with uv, add it as a dependency:
uv add tsadmetrics
Alternatively, install it with pip in your Python environment:
python -m 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
If TSADmetrics has been useful to you, and you would like to cite it in a scientific publication, please refer to the paper published in Neurocomputing:
@article{velasco2026tsadmetrics,
author = {Velasco, Pedro R. and Zafra, Amelia},
title = {TSADmetrics: A library for evaluating time series anomaly detection methods},
journal = {Neurocomputing},
volume = {698},
pages = {134154},
year = {2026},
doi = {10.1016/j.neucom.2026.134154},
url = {https://doi.org/10.1016/j.neucom.2026.134154}
}
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.
Metadata
Release files for tsadmetrics 1.0.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tsadmetrics-1.0.17.tar.gz | 107.8 kB | Without provenance | Details for tsadmetrics-1.0.17.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tsadmetrics-1.0.17-py3-none-any.whl | Python 3 | none | any | Details for tsadmetrics-1.0.17-py3-none-any.whl |
Total release size: 229.7 kB
Release files / tsadmetrics-1.0.17.tar.gz
| Download URL | tsadmetrics-1.0.17.tar.gz |
|---|---|
| Size | 107.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b0331f9ef06a733a356dc5ad8fc72d7a36869aecebff5334aa27ba4ae5451a7
|
|
BLAKE2b-256 checksum How to use checksums |
f8dca8156824fec2ebb23b8139f70f8b67d98f6d3de31541bbaaa295d8ead537
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / tsadmetrics-1.0.17-py3-none-any.whl
| Download URL | tsadmetrics-1.0.17-py3-none-any.whl |
|---|---|
| Size | 121.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ec0c23a4996438cbf0c8897620c647bf751d750a77ec9203622c461588a6d5e
|
|
BLAKE2b-256 checksum How to use checksums |
12ee99a2b2d6ccf4f67fcae6dcd1cc0d906a1b7e385ed722b46218ebae37c6f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for tsadmetrics 1.0.17
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.