Time-Series Models API¶
XLagDAMP ¶
XLagDAMP(subsequence_length: int, x_lag: int | None = None, start_index: int | None = None, eps: float = 1e-12)
Bases: BaseModel
Pure-online X-Lag Amnesic Discord Aware Matrix Profile detector.
Each event supplies one scalar time-series value. Once enough history is available, the model scores the subsequence ending at the current event by its z-normalized Euclidean distance to its nearest preceding subsequence. Higher scores indicate stronger left-discord candidates.
This implementation follows the authors' DAMP_X_Lag_Amnesic.m source:
- backward processing only (
lookahead=0), the authors' pure-online mode, - MASS_V2 distance profiles with population standard deviations,
- iterative doubling starting at
2^nextpow2(8 * subsequence_length), - best-so-far early abandoning,
- exact search over at most the most recent
x_lagvalues.
X-Lag amnesia bounds both memory and worst-case search history. As in the reference algorithm, early-abandoned scores are approximate: they are bounded by the exact left-discord score and the current best-so-far score. The highest peaks are the meaningful discord candidates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subsequence_length
|
int
|
Number of consecutive values in each subsequence. |
required |
x_lag
|
int | None
|
Maximum number of values searched backward. Defaults to the
authors' |
None
|
start_index
|
int | None
|
One-based subsequence start index at which processing
begins. Defaults to the authors' recommendation of at least four
cycles, |
None
|
eps
|
float
|
Numerical threshold used to reject constant subsequences. |
1e-12
|
Notes
- Input must contain exactly one consistently named numeric feature.
- Scores are
0.0beforestart_indexis reached. - Constant subsequences are rejected, matching the reference implementation's input restriction.
- State is bounded by
x_lag + subsequence_length - 1learned values.
References
Lu, Y., Wu, R., Mueen, A., Zuluaga, M. A., & Keogh, E. (2022). Matrix Profile XXIV: Scaling Time Series Anomaly Detection to Trillions of Datapoints and Ultra-fast Arriving Data Streams. https://doi.org/10.1145/3534678.3539271
Original authors' implementation and documentation: https://sites.google.com/view/discord-aware-matrix-profile/documentation