RandomSubspaceDetector<T>
Models & Types · AiDotNet.AnomalyDetection.Ensemble
Detects anomalies using Random Subspace ensemble method.
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → RandomSubspaceDetector<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
Random Subspace creates multiple detectors, each trained on a randomly selected subset of features. This helps detect anomalies that may only be visible in certain feature subspaces, which is common in high-dimensional data.
How It Works
The algorithm works by:
- Generate n_estimators random feature subsets
- Train a base detector on each subspace
- Combine scores using averaging or voting
When to use:
- High-dimensional data
- When anomalies hide in subspaces
- For robust detection across feature combinations
Industry Standard Defaults:
- N estimators: 20
- Max features: sqrt(n_features)
- Combination: Average
- Contamination: 0.1 (10%)
Reference: Keller, F., Muller, E., Bohm, K. (2012). “HiCS: High Contrast Subspaces for Density-Based Outlier Ranking.” ICDE.
Constructors
| Constructor | Summary |
|---|---|
RandomSubspaceDetector(int nEstimators, int maxFeatures, double contamination, int randomSeed) |
Creates a new Random Subspace anomaly detector. |
Properties
| Property | Summary |
|---|---|
int MaxFeatures { get; } |
Gets the maximum features per subspace. |
int NEstimators { get; } |
Gets the number of estimators. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |