MovingAverageDetector<T>
Models & Types · AiDotNet.AnomalyDetection.TimeSeries
Detects anomalies using moving average deviation in time series.
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → MovingAverageDetector<T>
For Beginners
This detector computes a moving average and identifies points that deviate significantly from their local average. It’s one of the simplest and most intuitive time series anomaly detection methods.
How It Works
The algorithm works by:
- Compute moving average and moving standard deviation
- For each point, compute deviation from local mean in std units
- High deviations indicate anomalies
When to use:
- Simple time series without complex patterns
- As a baseline method
- Real-time anomaly detection (streaming data)
Industry Standard Defaults:
- Window size: 20
- Threshold: 3 standard deviations
- Contamination: 0.1 (10%)
Constructors
| Constructor | Summary |
|---|---|
MovingAverageDetector(int windowSize, double stdThreshold, double contamination, int randomSeed) |
Creates a new Moving Average anomaly detector. |
Properties
| Property | Summary |
|---|---|
double StdThreshold { get; } |
Gets the standard deviation threshold. |
int WindowSize { get; } |
Gets the window size. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |