Semi-supervised One-class SVM

Machine Learning
Introduced by
Extension of Scholkopf et al. (2001); semi-supervised variants studied ca. 2004–2010
Year
2001–2004
Type
Semi-supervised anomaly / novelty detection
Family
Machine learning

What does it do?

Semi-supervised One-class SVM is a variant of the One-class SVM that adds a pool of unlabeled observations to a small set of confirmed-normal examples when fitting an anomaly boundary.

It is not an established, separately named algorithm: the procedure described here is a self-training loop wrapped around the one-class SVM, and the pseudo-labelling rules differ between implementations. Its advantage over the purely supervised-on-normals One-class SVM depends mainly on how clean the labeled seed and the unlabeled pool are.

The intuition behind the method

A One-class SVM fitted only to labeled normal data learns its boundary from whatever normal examples are available. When that set is small, the boundary can be too loose or can fit peculiarities of the seed. This variant adds unlabeled observations, which are assumed to be mostly normal, and feeds the model's own provisional labels back into training so the boundary can settle around the denser normal regions. The gain is conditional: if the unlabeled pool contains many anomalies, the same loop can pull them into the normal class.

History

The one-class SVM was introduced by Schölkopf et al. (2001) as a way to estimate the support of a high-dimensional distribution from data, using a kernel expansion and quadratic programming. The semi-supervised variant described on this page is a self-training procedure built on that method. It is not an established, separately named algorithm, and no specific originator or publication date is attributed to it here.

When to use it

Consider this variant when anomalies are rare or unlabeled, labelling all data is impractical, a clean set of confirmed-normal examples is available, and the features are numeric so that a kernel can be applied. It is a reasonable choice when the unlabeled pool is believed to be dominated by normal behaviour and comes from the same process that produced the seed. Do not use it when the labeled seed is small, noisy, or drawn from a different process than the pool; when the unlabeled pool may contain substantial contamination; when a reasonable number of well-labeled anomalies exist, since a supervised classifier is then the natural comparison; or when the analysis requires an interpretable boundary, because the kernel expansion does not provide explicit feature coefficients.

Limitations and considerations

  • The starting boundary is fixed by the labeled seed; a small or unrepresentative seed places it in the wrong region, and the self-training loop tends to reinforce that error.
  • Contamination in the unlabeled pool is absorbed into the normal class during refinement, because the loop treats accepted points as normal.
  • The one-class SVM is fitted by quadratic programming (Schölkopf et al. (2001) solve it by sequential optimization over pairs of points), and repeated retraining multiplies this cost across iterations.
  • The pseudo-labelling rule is not standardized, so results can differ between implementations and are harder to reproduce.
  • The nu parameter and kernel bandwidth must be tuned, but the labeled seed contains only normal examples, so tuning without labeled anomalies is limited.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Uses unlabeled observations, which are often inexpensive to collect, without requiring every point to be annotated.
  • The base one-class formulation of Schölkopf et al. (2001) needs only normal-class examples and no anomaly labels; this variant additionally uses an unlabeled pool.
  • The kernel mapping allows nonlinear normal regions, because the boundary is defined in the feature space induced by the kernel.
  • The nu parameter gives an explicit handle on the expected fraction of outliers in the training data, which can be informed by domain knowledge.
  • The decision value ranks observations by distance from the boundary, which supports triage, although it is not a calibrated probability.

Applications

  • Screening sensor streams where a verified log of normal operation exists and new unlabeled logs accumulate over time.
  • Quality control of imaging or measurement data where confirmed-good records are available and defective records are rare.
  • Monitoring transaction or traffic features where only confirmed-normal activity has been reviewed.

How it works

How it works

1

Split the training data into a small labeled set of confirmed-normal instances and an unlabeled pool, which in typical use is larger and drawn from the same operational source. The pool is not verified, so its anomaly content is unknown. The quality of the labeled seed largely determines the starting boundary.

2

Map all observations into a reproducing kernel Hilbert space using a kernel function, most commonly the RBF kernel. In that feature space the one-class SVM looks for a hyperplane that separates the mapped data from the origin, the geometric idea introduced by Schölkopf et al. (2001).

Formula
\phi: \mathcal{X} \rightarrow \mathcal{F}
3

Fit a one-class SVM using only the labeled normal examples. This yields a weight vector w, an offset rho and slack variables xi. The parameter nu upper-bounds the fraction of training points treated as outliers and lower-bounds the fraction of support vectors, as in the original formulation.

Formula
\min_{w,\xi,\rho} \frac{1}{2}\|w\|^2 + \frac{1}{\nu n}\sum_i \xi_i - \rho
4

Score the unlabeled pool with the current model and assign provisional labels. Points accepted as normal are added to the normal training set; points flagged as anomalous are discarded or down-weighted. No single rule is standard for this step: confidence thresholds, soft weights or label propagation over a similarity graph are design choices that should be stated and tested.

5

Retrain the one-class SVM on the labeled seed plus the accepted pseudo-labels, then repeat. Because each round's labels come from the previous model, errors can compound across iterations, so a stopping rule is needed, such as a fixed iteration budget or a check that the boundary has stopped changing.

6

Map a new observation through the same kernel and evaluate the decision function. Observations with negative values fall outside the learned boundary and are flagged. The magnitude of the value reflects distance from the boundary and can rank observations for review, but it is not a calibrated probability of being anomalous. Flagging at a chosen false-alarm rate requires a threshold on the decision value, which is a design decision rather than a fixed value. One common choice is a quantile of the decision values computed on held-out normal observations, which approximately controls the false-alarm rate on normal data; the chosen threshold should be checked on data not used for fitting.

Formula
f(x) = \text{sign}(w^\top \phi(x) - \rho)

Common pitfalls

  • Using a labeled seed drawn from different conditions than the unlabeled pool, which causes systematic pseudo-label errors.
  • Setting nu without any estimate of the anomaly fraction, which can lead to over- or under-detection.
  • Accepting pseudo-labels without confidence thresholds or soft weighting, so that early errors propagate through later rounds.
  • Evaluating only with unsupervised cluster measures when some annotated anomalies exist; a held-out set of those anomalies is the only direct check on whether the loop helped.
  • Conflating this method with the transductive SVM (S3VM), which addresses semi-supervised binary classification rather than one-class detection.

Frequently asked questions

How large does the labeled seed need to be?

No minimum seed size is established for this variant. The seed should cover the main modes of normal behaviour. Normal modes missing from the seed may be scored as anomalous and excluded during pseudo-labelling; whether this happens depends on the chosen rule and has not been verified for this method. A small seed can also leave the boundary poorly placed.

What if the unlabeled pool is heavily contaminated with anomalies?

If the pool contains many anomalies, the refinement loop can gradually absorb them into the normal class. Stricter acceptance of pseudo-labels, lower weights for uncertain points, or a comparison with the one-class SVM fitted on the labeled seed alone are ways to check whether the loop is helping.

How do I choose the kernel and nu parameter?

The RBF kernel is the usual default, and its bandwidth (gamma) and nu are normally chosen together. Nu bounds the fraction of training outliers, so an estimate of the anomaly fraction is a sensible starting point. With normal-only labels, tuning is limited, so use any available labeled anomalies or domain checks to validate the choice.

Is this different from a transductive SVM (S3VM)?

Yes. The transductive SVM (S3VM) performs semi-supervised binary classification in which both classes are partially labeled. The semi-supervised One-class SVM addresses anomaly detection: it uses only normal-class labels and treats unlabeled observations as potential normals, not as a second class to be classified.

Can I use this method at scale?

The cost of standard SVM solvers grows quickly with the number of observations, and iterative retraining repeats that cost. For large datasets, approximate kernel methods or alternative detectors such as those listed under related methods are common choices. No specific dataset size is given here as a cut-off; the practical limit depends on the solver and the available hardware.

Related methods

Sources

  1. Munoz, A. & Muruzabal, J. (2004). Self-Organising Maps for Outlier Detection. Neurocomputing, 58–60, 953–956.

    Open publication reference
  2. 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 reference