PercentileDetector<T>

Models & Types · AiDotNet.AnomalyDetection.Statistical

Detects anomalies using percentile-based thresholds.

Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → PercentileDetector<T>

Implements: IGeneratedParameterRegistrar<T>

For Beginners

This detector uses percentiles to identify extreme values. Points that fall below the low percentile or above the high percentile are flagged as anomalies. It’s simple and effective for univariate or feature-wise anomaly detection.

How It Works

The algorithm works by:

  1. Compute the specified percentiles for each feature
  2. For each point, check if values are outside the percentile bounds
  3. Score based on how far outside the bounds a point falls

When to use:

  • Simple univariate anomaly detection
  • When you don’t want to assume a distribution
  • As a baseline method

Industry Standard Defaults:

  • Low percentile: 5 (5th percentile)
  • High percentile: 95 (95th percentile)
  • Contamination: 0.1 (10%)

Constructors

Constructor Summary
PercentileDetector(double lowPercentile, double highPercentile, double contamination, int randomSeed) Creates a new Percentile anomaly detector.

Properties

Property Summary
double HighPercentile { get; } Gets the high percentile threshold.
double LowPercentile { get; } Gets the low percentile threshold.

Methods

Method Summary
Vector<T> ScoreAnomalies(Matrix<T> X)
void Fit(Matrix<T> X)