OCSVMDetector<T>
Models & Types · AiDotNet.AnomalyDetection.DistanceBased
Detects anomalies using One-Class SVM with simplified SGD training.
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → OCSVMDetector<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
One-Class SVM finds a boundary that encompasses the normal data. It learns the shape of normal data in a high-dimensional kernel space and flags points outside this region as anomalies.
How It Works
The algorithm works by:
- Map data to kernel space using RBF kernel
- Find hyperplane that separates data from origin with maximum margin
- Points on the negative side of the hyperplane are anomalies
When to use:
- When you have only normal examples
- High-dimensional data
- When you need a decision boundary
Industry Standard Defaults:
- Nu: 0.1 (roughly proportion of outliers)
- Gamma: auto (1/n_features)
- Kernel: RBF
- Contamination: 0.1 (10%)
Reference: Schölkopf, B., et al. (2001). “Estimating the Support of a High-Dimensional Distribution.”
Constructors
| Constructor | Summary |
|---|---|
OCSVMDetector(double nu, double gamma, int maxIterations, double contamination, int randomSeed) |
Creates a new OCSVM anomaly detector. |
Properties
| Property | Summary |
|---|---|
double Gamma { get; } |
Gets the gamma parameter. |
double Nu { get; } |
Gets the nu parameter. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |