← Lessons

quiz vs the machine

Platinum1720

Machine Learning

The One Class SVM

Learning a boundary around normal data to flag everything outside.

5 min read · advanced · beat Platinum to climb

The One Class SVM

The one class support vector machine learns a boundary around normal data so that anything falling outside is treated as an anomaly. It is trained on examples of normal behavior alone, with no anomaly labels.

The core idea

A standard SVM separates two classes. The one class version has only one class, so it instead finds a region that contains most of the training points while staying as tight as possible.

  • The Schoelkopf formulation separates the data from the origin with a maximal margin in feature space.
  • An alternative, support vector data description, fits the smallest enclosing sphere around the data.

Points inside the learned region are scored as normal, points outside as anomalous.

The nu parameter

A key parameter is nu, between zero and one. It upper bounds the fraction of training points allowed to fall outside the boundary and lower bounds the fraction used as support vectors. Larger nu makes a tighter boundary that flags more points.

Kernels and caveats

Using a kernel such as the radial basis function lets the boundary curve around complex shapes. The method is powerful but sensitive to scaling and to nu, and it can degrade when the normal data itself is noisy or multi modal.

Key idea

A one class SVM fits a tight kernel boundary around normal data, flagging points outside it as anomalies, with nu controlling the boundary tightness.

Check yourself

Answer to earn rating on the learn ladder.

1. What does a one class SVM learn?

2. What does the nu parameter control?

3. Why might a kernel like the radial basis function be used?