LOCIDetector<T>
Models & Types · AiDotNet.AnomalyDetection.DistanceBased
Detects anomalies using Local Correlation Integral (LOCI).
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → LOCIDetector<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
LOCI is a density-based outlier detection method that automatically determines the appropriate neighborhood size. It computes a Multi-Granularity Deviation Factor (MDEF) that indicates how much a point’s local density deviates from its neighborhood’s density.
How It Works
The algorithm works by:
- For multiple radius values, compute local density
- Compare point’s density to average density of neighbors (MDEF)
- Flag points with MDEF exceeding a threshold based on standard deviation
When to use:
- When you don’t want to manually tune neighborhood size
- Data has varying local densities
- You want automatic threshold determination
Industry Standard Defaults:
- Alpha: 0.5 (neighborhood multiplier)
- Contamination: 0.1 (10%)
Reference: Papadimitriou, S., et al. (2003). “LOCI: Fast Outlier Detection Using the Local Correlation Integral.” ICDE.
Constructors
| Constructor | Summary |
|---|---|
LOCIDetector(double alpha, int kMax, double contamination, int randomSeed) |
Creates a new LOCI anomaly detector. |
Properties
| Property | Summary |
|---|---|
double Alpha { get; } |
Gets the alpha parameter (sampling neighborhood ratio). |
int KMax { get; } |
Gets the maximum number of neighbors to consider. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |