RobustPCADetector<T>
Models & Types · AiDotNet.AnomalyDetection.Linear
Detects anomalies using Robust PCA (Principal Component Pursuit).
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → RobustPCADetector<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
Robust PCA decomposes data into a low-rank component (normal patterns) and a sparse component (anomalies). Unlike standard PCA, it’s robust to outliers because it explicitly models them as sparse corruptions.
How It Works
The algorithm works by:
- Decompose data matrix M = L + S
- L is low-rank (captures normal patterns)
- S is sparse (captures anomalies)
- Solve via convex optimization (ADMM)
When to use:
- Data corrupted by sparse anomalies
- When standard PCA is affected by outliers
- Video surveillance (background subtraction)
- Network intrusion detection
Industry Standard Defaults:
- Lambda: 1/sqrt(max(n,m))
- Max iterations: 1000
- Tolerance: 1e-7
- Contamination: 0.1 (10%)
Reference: Candès, E.J., et al. (2011). “Robust Principal Component Analysis?” JACM.
Constructors
| Constructor | Summary |
|---|---|
RobustPCADetector(double lambda, int maxIterations, double tolerance, double contamination, int randomSeed) |
Creates a new Robust PCA anomaly detector. |
Properties
| Property | Summary |
|---|---|
double Lambda { get; } |
Gets the lambda parameter (sparsity penalty). |
int MaxIterations { get; } |
Gets the maximum iterations. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |