What is One-Class SVM?
One-Class SVM is an unsupervised kernel method that estimates a boundary around a reference distribution and assigns new observations a signed decision score for novelty detection.
Quick Facts
| Full Name | One-Class Support Vector Machine |
|---|---|
| Created | 2001 by Bernhard Schölkopf, John Platt, John Shawe-Taylor, Alex Smola, and Robert Williamson |
| Specification | Official Specification |
How It Works
Fit a kernel level set rather than a second class
The standard ν-One-Class SVM optimizes a separating hyperplane in feature space with offset rho, slack variables, and a parameter nu. Its decision function has the form sum_i alpha_i k(x_i,x)-rho; only training examples with nonzero coefficients become support vectors.
The original support estimation paper connects this construction to estimating a high-density subset. It does not prove that the learned region equals a semantic class or that every outside point is harmful.
Interpret nu and contamination under stated assumptions
For the standard ν formulation, nu controls bounds related to the fraction of margin errors and support vectors under the optimization assumptions. It is not simply the expected production anomaly rate, and finite samples, duplicated observations, solver tolerance, or weighting can complicate an exact empirical interpretation.
Novelty detection assumes the reference training set is mostly clean and scores new samples afterward. Outlier detection fits in the presence of contamination. One-Class SVM can be sensitive to contaminated references, so curate data, test injected anomalies, and compare robust or density-based alternatives.
Calibrate a decision policy and monitor drift
Fit scaling, feature extraction, kernel family, bandwidth, and nu inside training-only resampling. Select the operating threshold using representative normal data, known incidents, synthetic challenges, or review capacity; do not silently assume the solver's zero boundary matches the required alert rate.
Current scikit-learn outlier guidance distinguishes novelty and outlier detection and notes One-Class SVM sensitivity. Monitor score distributions, alert volume, support-vector count, false positives, delayed labels, and reference drift after deployment.
Key Characteristics
- Learns an acceptance region without requiring labeled anomaly examples
- Represents its decision function through kernel evaluations and support vectors
- Uses nu to constrain optimization behavior rather than set a probability
- Returns a signed novelty score under an implementation-specific convention
- Depends strongly on feature scaling and kernel bandwidth
- Can be distorted by contamination in the reference training set
Common Use Cases
- Screening new sensor observations against a healthy reference period
- Flagging unusual transactions when confirmed fraud labels are scarce
- Detecting novel manufacturing measurements for human inspection
- Monitoring embeddings for departures from a curated reference corpus
- Building a nonlinear novelty baseline beside Isolation Forest or density methods
Example
Loading code...Frequently Asked Questions
Is One-Class SVM supervised or unsupervised?
It is commonly treated as unsupervised because fitting does not require labeled anomalies or a second class. The workflow still needs supervision from domain rules, review, known incidents, or synthetic tests to select features, tune thresholds, and evaluate alerts.
What does nu mean in One-Class SVM?
Nu is an optimization parameter tied to bounds on margin errors and support-vector fraction in the standard formulation. It does not directly equal anomaly probability or guarantee the same alert rate on future data, especially under drift.
Is a negative One-Class SVM score an anomaly probability?
No. It indicates which side of the fitted level-set boundary a sample occupies under the chosen score convention. Calibrate a separate action threshold with validation evidence, and avoid comparing raw magnitudes across retrained models without alignment.
Can One-Class SVM train on contaminated data?
It can fit such data, but contaminated reference points may pull or fragment the learned boundary. Estimate contamination, inspect influential support vectors, compare robust alternatives, and validate against held-out normal periods plus known or injected anomalies.
How should One-Class SVM be monitored in production?
Track input and score drift, threshold exceedance rate, support-vector count, latency, review outcomes, and delayed incident labels. Retrain only through a versioned process that prevents detected anomalies from automatically becoming trusted reference data.