Introduction
dtaianomaly is an open-source Python library designed to bridge the gap between state-of-the-art time series anomaly detection (TSAD) research and production-ready applications. By providing a standardized, scikit-learn-style interface, it simplifies the process of building, benchmarking, and deploying anomaly detection pipelines for both researchers and industry engineers.
The field of TSAD is currently fragmented. Many algorithms exist only as standalone scripts with inconsistent APIs, making them difficult to integrate or compare. Furthermore, existing benchmarking tools often have high barriers to entry, such as requiring Docker containers, or lack focus on industry-relevant constraints like memory usage and execution time. dtaianomaly addresses these issues by offering a coherent, extensible framework.
Library Architecture
The library is built around an object-oriented design that mirrors the familiar scikit-learn ecosystem, significantly lowering the cognitive load for developers. If a user is familiar with standard machine learning tools, they can immediately leverage dtaianomaly for complex time series tasks.
Key technical components include:
- Standardized API: Every detector implements a consistent interface using
.fit()and.decision_function(). The library favors.decision_function()over the standard.predict()because anomaly detection typically yields continuous scores (like distances) rather than simple binary labels. - Pipeline & Workflow Modules: Users can chain
PreprocessorsandDetectorsinto a singlePipelineobject. For large-scale experiments, theWorkflowmodule automates "grid-search" style evaluations across multiple datasets and models, handling error logging and performance tracking automatically. - Extensibility: The library is designed so that researchers only need to implement two methods to make a new algorithm compatible with the entire evaluation suite.
Comparative Analysis and Key Features
A core differentiator for dtaianomaly is its focus on industry-first features. Unlike many research-centric libraries, it includes built-in tools for confidence prediction—quantifying model certainty—and profiling to track CPU and memory footprints. This ensures that models are not only accurate but also viable for deployment on resource-constrained edge devices.
As shown in the qualitative comparison below, dtaianomaly is currently the only library providing a "full house" of features, including visualization, confidence prediction, memory profiling, and rigorous unit testing.
Performance and Results
In terms of raw performance, the library's implementation of the Matrix Profile detector is highly efficient. In illustrative tests on heartbeat datasets, processing 45,000 observations took less than 2 seconds, while a larger dataset of 105,000 observations took only 8 seconds.
To facilitate benchmarking, the library provides a dedicated UCRLoader to seamlessly integrate with the UCR Anomaly Archive, a standard benchmark in the field. This allows researchers to validate their work against real-world constraints and established datasets with minimal setup.
Conclusion and Future Work
While dtaianomaly provides a robust foundation, several areas remain for future development. Support for deep learning (neural models) and foundation models is currently experimental. Future iterations aim to include "context-aware" wrappers to account for external factors like seasonality, human-in-the-loop feedback mechanisms for expert correction, and AutoML capabilities for automated model and hyperparameter selection.
Summary updated