IAnomalyDetector<T>
Interfaces · AiDotNet.Interfaces
Defines methods for algorithmic anomaly/outlier detection using a fit-predict pattern.
Implements: IFullModel<T, Matrix<T>, Vector<T>>
Known implementations: AnomalyDetectorBase<T>
For Beginners
This interface provides a machine learning-style approach to anomaly detection. Unlike simple statistical methods (like Z-score or IQR), algorithmic detectors learn patterns from your data and can detect more complex types of anomalies.
How It Works
The typical workflow is:
- Create a detector with your desired parameters (contamination defaults to 0.1 / 10%)
- Call
Fitto train the detector on your data - Call
Predictto identify anomalies in new data - Optionally use
ScoreAnomaliesto get anomaly scores for ranking
Anomaly Detection vs Outlier Removal:
- Anomaly Detection: The primary task - identifying unusual patterns in data
- Outlier Removal: A preprocessing step that uses anomaly detection to clean data
This interface focuses on anomaly detection. For preprocessing use cases, wrap detectors
with DetectorBasedFilter to integrate them into PreprocessingPipeline.
Properties
| Property | Summary |
|---|---|
T Threshold { get; } |
Gets the threshold used to classify samples as inliers or outliers. |
bool IsFitted { get; } |
Gets a value indicating whether the detector has been fitted to data. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
Computes the anomaly score for each sample. |
void Fit(Matrix<T> X) |
Trains the anomaly detector on the provided data. |