Skip to content

One-Class SVM

Learns a tight boundary around normal data only, then flags anything that falls outside it as an anomaly.

Also OCSVM · support vector data description · novelty detection SVM

Fig. / How it works
LEARN THE EDGE OF NORMAL · OUTSIDE = ANOMALY
Role · kind
Models and algorithmsModel
Level
Advanced

Schölkopf et al., 2001

You only ever see healthy apples. You learn the shape of 'normal apple' so well that the first rotten one stands out, even though you never saw a rotten apple before.

Where it fits

+All relationships as a list

Is a kind of / part of

Uses / built on

Techniques that apply here

See it on the full map

How it works

A normal support vector machine separates two classes. In anomaly detection you often have only one: plenty of normal data and almost no examples of what can go wrong. A one-class SVM works with just that.

It draws the tightest reasonable boundary around the normal data. Thanks to the kernel trick, that boundary can be any blob-like shape, not just a circle. New points inside are normal; points outside are flagged.

The setting ν\nu (nu) says how strict to be: ν=0.05\nu = 0.05 lets roughly 5% of the training points fall outside, which helps when the “normal” data is a little dirty.

On large or high-dimensional datasets, an isolation forest is usually faster and easier to tune, so it is a common first choice today.

Everyday use cases

  • Case 01

    Machine health monitoring

    Learns what normal vibration readings look like and raises an alarm when a motor starts behaving differently.

  • Case 02

    Intrusion detection

    Flags network sessions that look unlike the normal traffic it was trained on.

Strengths, weaknesses and when to use it

Strengths

  • Needs only normal examples, no labeled anomalies.
  • Flexible curved boundaries through the kernel.

Weaknesses

  • Sensitive to the kernel width and ν; hard to tune without some labeled anomalies.
  • Scales poorly to very large datasets.

When to use itNovelty detection on small to medium datasets with a clean sample of normal behavior.

Compare with

Check yourself

  1. Q01

    What does a one-class SVM need for training?

    Show answer

    B: Examples of normal data only

  2. Q02

    What does the ν (nu) parameter control?

    Show answer

    B: Roughly the fraction of training points allowed to fall outside the boundary

Go deeper