ZScoreDetector<T>
Models & Types · AiDotNet.AnomalyDetection.Statistical
Detects anomalies using the Z-Score method (standard score).
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → ZScoreDetector<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
The Z-Score measures how many standard deviations a value is from the mean. A Z-Score of 0 means the value equals the mean. A Z-Score of 2 means the value is 2 standard deviations above the mean. Points with extreme Z-Scores (typically |Z| > 3) are anomalies.
How It Works
When to use:
- Your data is approximately normally distributed
- You want a simple, interpretable method
- You have single-variable or multi-variable data where anomalies are extreme in at least one dimension
Industry Standard Defaults:
- Threshold: 3.0 (flags ~0.3% of normally distributed data)
- Contamination: 0.1 (10%) - used for automatic threshold tuning
Constructors
| Constructor | Summary |
|---|---|
ZScoreDetector(double zThreshold, double contamination, int randomSeed) |
Creates a new Z-Score anomaly detector. |
Properties
| Property | Summary |
|---|---|
Vector<T> Means { get; } |
Gets the fitted mean values for each feature. |
Vector<T> StandardDeviations { get; } |
Gets the fitted standard deviation values for each feature. |
double ZThreshold { get; } |
Gets the Z-Score threshold. |
Methods
| Method | Summary |
|---|---|
Vector<T> Predict(Matrix<T> X) |
|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |