- Introduced by
- Tax, D. M. J. & Duin, R. P. W. (ensemble OC classifiers); Scholkopf et al. (OC-SVM base)
- Year
- 2001
- Type
- Ensemble anomaly detector
- Family
- Machine learning
What does it do?
Ensemble One-Class SVM trains several one-class support vector machines, each on a different random subset of observations or features, and combines their anomaly scores into one decision.
It is designed to reduce the variance that a single one-class SVM shows with respect to kernel settings and the sampling of training data. This benefit depends on the members being sufficiently diverse and should be checked on held-out data. The method is intended for settings where only normal-class data are available for training.
The intuition behind the method
A one-class SVM fits a boundary around the normal training data, and where that boundary lies depends on the kernel, the regularisation setting and which observations were sampled. Training several such models on different views of the data and combining their scores is meant to average out these choices. Because the members place their boundaries differently, a point that many members place outside the normal region gives a more stable signal than a point flagged by one model alone. Agreement across members reduces dependence on any single fit, but it does not establish that a flagged point is a genuine anomaly. Flagged points still need validation on labelled or held-out data.
History
Scholkopf et al. (2001) introduced the one-class SVM as a way to estimate a region that captures a specified fraction of a distribution, using a kernel expansion fitted by quadratic programming. Tax and Duin (2001) studied combining one-class classifiers in general. The cited record gives only the title and venue, so their specific methods are not described here. The ensemble of one-class SVMs discussed on this page combines these two lines of work and is not attributed to a single paper.
When to use it
Choose Ensemble One-Class SVM when the training data contain only normal observations, or when anomalies are too rare to use for training, and the features are numeric. It is a reasonable option when the kernel, gamma or nu setting is uncertain, since varying these across members can add diversity. Whether the combined score is actually more stable than a single well-tuned model must be checked on held-out data. Do not use it when reliable two-class labelled data exist, because supervised classifiers make better use of those labels. With few observations, bootstrap replicates can overlap heavily, so diversity should come from random subspaces or varied kernel and nu settings instead. Check the correlation between members before concluding that the ensemble adds value. The method is also a poor fit when each flag must be explained to a non-specialist, since the ensemble is no more interpretable than a single one-class SVM.
Limitations and considerations
- Cost grows with the number of base models, since each one solves its own kernel optimisation, which is expensive for large training sets without approximations.
- Adds design choices beyond a single one-class SVM: the diversity strategy, the number of members, and the kernel and nu settings for each member.
- Interpretability is low: neither the combined score nor any individual boundary in kernel feature space gives a simple explanation of why a point was flagged.
- The ensemble does not guarantee better detection than a single well-tuned one-class SVM or than other anomaly detectors on a given dataset, so this must be checked on held-out data.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Averaging over base models is intended to reduce the variance a single one-class SVM shows under changes in kernel parameters and training subsamples, to the extent that the members are diverse.
- Each base model is fitted independently, so training can be run in parallel across members.
- Only normal-class observations are needed for training, because each base model is a one-class SVM in the formulation of Scholkopf et al.
- Keeping continuous decision values rather than hard votes preserves graded information about how far a point lies outside each learned region.
- Random subspace and bootstrap diversity strategies allow the ensemble to be varied without hand-tuning each member separately.
Applications
- Network intrusion detection trained on normal traffic only.
- Industrial fault detection where faulty examples are rare or unavailable during training.
- Medical novelty detection to flag unusual patterns against a normal reference group.
- Fraud detection when labelled fraud examples are scarce.
- Quality control in manufacturing using only good-product data for training.
How it works
How it works
Several one-class SVMs are fitted independently on the available normal (or presumed normal) training data. Each one uses a kernel function, commonly the RBF kernel, to map the data into a feature space. It learns a function f that is positive on a region S intended to capture the normal data and negative on its complement, following the formulation of Scholkopf et al. The function is a kernel expansion in terms of a potentially small subset of the training data, and it is regularised by controlling the length of the weight vector in the feature space. Its coefficients are found by solving a quadratic programming problem, so each base model is a separate optimisation. The a priori specified fraction of test points expected to lie outside the region sets how tightly the boundary fits. In the usual formulation this fraction is controlled by the parameter nu, which acts as an upper bound on the fraction of training points lying outside the region.
Diversity is what makes the ensemble differ from a single model. Common strategies include random subspace sampling (each base model sees a random subset of features), bootstrap sampling (each model is trained on a bootstrap draw of the training observations), or varying the kernel width or the nu parameter across members. If the base models are nearly identical, combining them adds little beyond a single one-class SVM.
Each base model returns a signed decision value for a test point, with negative values indicating points outside its learned region. The ensemble combines these values by averaging them, by taking the maximum, or by majority vote on the binary inlier/outlier labels. Averaging continuous values keeps information about how far a point lies from each boundary, which a binary vote discards.
A single threshold is applied to the combined score to label points as normal or anomalous. In the pure one-class setting it is chosen from an assumed contamination rate, meaning the expected fraction of outliers in the training data, or set so that a chosen fraction of normal training points is flagged. If a small labelled hold-out set is available, using it is an optional departure from the pure one-class setting. The threshold can then be chosen on that set to reach a target false-positive rate. Whichever route is used, the threshold must be fixed before test data are scored, and test data must never enter threshold selection, because choosing it on the test data inflates apparent detection rates.
Common pitfalls
- Training base models on identical data without any diversity mechanism, which produces a correlated ensemble with little variance reduction.
- Setting the contamination threshold on the test set rather than the training set, which inflates apparent detection rates.
- Ignoring the cost of SVM training, which grows roughly quadratically or worse with the number of training points depending on the solver. Ensemble training on large datasets without kernel approximation can be prohibitively slow.
- Comparing only accuracy or F1 without reporting AUROC and precision-recall curves, which are more informative when anomalies are rare.
- Treating the contamination rate as known when the outlier proportion is unknown, so the threshold reflects an assumption rather than the data.
- Training on unscaled numeric features, so that the RBF kernel and gamma are dominated by high-variance features. Standardise features using training-set statistics only, and apply the same transformation to test data, before fitting each base model.
Frequently asked questions
How many base OC-SVM models should the ensemble contain?
There is no fixed number that is correct for every dataset. Start with a modest ensemble, track held-out performance as members are added, and stop when further gains become negligible, since computational cost grows with each added model.
How does this compare to isolation forest for anomaly detection?
Isolation forest is often used as a first baseline because it needs less tuning and is usually cheaper on large datasets. An ensemble OC-SVM may be worth testing when the normal region has a smooth, kernel-representable shape, but it should be compared against such a baseline on held-out data rather than assumed to be better.
What kernel should I use for the base OC-SVMs?
The RBF (Gaussian) kernel is the usual starting point. Varying gamma across base models is one way to create diversity; a random feature approximation of the RBF kernel is one option when exact kernels are too costly.
Can I use this method when I have some labelled anomalies?
If you have even a small number of labelled anomalies, semi-supervised methods or standard classifiers with appropriate class weighting are likely to make better use of the data. Reserve one-class methods for truly unlabelled or single-class settings.
How do I set the contamination rate?
Set it based on domain knowledge, such as a historical fault rate, or estimate it from the training data distribution. Avoid using test-set information to select the threshold, as this produces overly optimistic detection rates.
Related methods
Sources
Scholkopf, B., Platt, J. C., Shawe-Taylor, J., Smola, A. J., & Williamson, R. C. (2001). Estimating the support of a high-dimensional distribution. Neural Computation, 13(7), 1443–1471.
Open DOI referenceTax, D. M. J., & Duin, R. P. W. (2001). Combining one-class classifiers. In Multiple Classifier Systems (MCS 2001), Lecture Notes in Computer Science, vol 2096. Springer, Berlin, Heidelberg.
Open DOI reference