MatrixProfileDetector<T>
Models & Types · AiDotNet.AnomalyDetection.TimeSeries
Detects anomalies using Matrix Profile for time series discord detection.
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → MatrixProfileDetector<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
Matrix Profile computes the distance to the nearest neighbor subsequence for every subsequence in a time series. Subsequences with no similar matches (discords) are anomalies. It’s one of the most powerful time series anomaly detection methods.
How It Works
The algorithm works by:
- Extract all subsequences of length m
- For each subsequence, find the nearest neighbor (excluding trivial matches)
- Store these distances as the Matrix Profile
- High values in the Matrix Profile indicate discords (anomalies)
When to use:
- Time series pattern anomaly detection
- Finding unusual subsequences
- Discord discovery in time series
Industry Standard Defaults:
- Subsequence length: 50 (or approximately one period)
- Exclusion zone: m/4
- Contamination: 0.1 (10%)
Reference: Yeh, C.C.M., et al. (2016). “Matrix Profile I: All Pairs Similarity Joins for Time Series: A Unifying View.” IEEE ICDM.
Constructors
| Constructor | Summary |
|---|---|
MatrixProfileDetector(int subsequenceLength, int exclusionZone, double contamination, int randomSeed) |
Creates a new Matrix Profile anomaly detector. |
Properties
| Property | Summary |
|---|---|
int ExclusionZone { get; } |
Gets the exclusion zone size. |
int SubsequenceLength { get; } |
Gets the subsequence length. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |