One-Class SVM
One-Class Support Vector Machine (Novelty and Anomaly Detection) · Also known as: OCSVM, one-class support vector machine, novelty SVM, unsupervised SVM
One-class SVM is an unsupervised anomaly and novelty detection algorithm that learns a tight boundary around normal training data in a kernel-induced feature space, flagging new observations that fall outside that boundary as outliers. Introduced by Scholkopf et al. in 1999–2001, it extends the SVM framework to the single-class setting where no labelled anomalies are available.
Read the full method
Sign in with a free account to read this section.
Method map
The neighbourhood of related methods — select a node to explore.
+18 more
When to use it
Use One-class SVM when labelled anomaly examples are unavailable or very scarce and you want a non-linear boundary around normal behaviour — typical in fraud detection, intrusion detection, industrial fault monitoring, and medical novelty screening with continuous numeric features. It works best on moderately sized datasets (hundreds to tens of thousands of samples) and high-dimensional or complex-shaped normality distributions where linear or distance-based detectors fail. Avoid it when: the training set is very large (n > ~100 000), because the quadratic solve scales poorly; the data are highly categorical; or when fast, interpretable rules are required. In those cases prefer Isolation Forest, Local Outlier Factor, or a threshold-based statistical model.
Strengths & limitations
- Works with no labelled anomaly examples — only normal training data are required.
- Non-linear kernel (typically RBF) captures complex, curved boundaries of normality that distance-based methods miss.
- The nu parameter gives direct, interpretable control over the expected outlier fraction.
- Scales gracefully to high-dimensional feature spaces via the kernel trick.
- The continuous decision score enables flexible downstream threshold calibration.
- Proven in high-stakes domains such as intrusion detection, fault monitoring, and medical imaging.
- Quadratic programming solver scales as O(n^2) to O(n^3) in training samples, making it impractical for very large datasets.
- Sensitive to the choice of kernel and its hyperparameters (e.g., RBF gamma); poor choices produce either too tight or too loose a boundary.
- Requires clean normal training data — contaminated training sets shift the boundary and inflate false-negative rates.
- Does not naturally produce calibrated probability estimates; the decision score is not a probability.
- Interpretability is limited; explaining why a specific point is flagged is difficult without additional post-hoc tools.
Frequently asked
What is the difference between One-class SVM and Isolation Forest for anomaly detection?
One-class SVM learns a kernel-based boundary around normal data and performs well on high-dimensional, complex-shaped distributions, but scales poorly with dataset size. Isolation Forest uses random partitioning and is much faster on large datasets but is generally less sensitive to subtle, non-linear anomaly patterns.
How should I choose the nu parameter?
Set nu to the fraction of training observations you expect to be contaminated or atypical. If you believe fewer than 5% of your training samples are outliers, start with nu=0.05. Use a held-out set of known normal examples to evaluate boundary tightness rather than relying on grid search alone.
What kernel should I use?
The RBF (Gaussian) kernel is the standard starting point and handles most continuous numeric datasets well. The gamma hyperparameter of the RBF kernel controls the radius of influence; cross-validate over a log-spaced grid. Linear kernels are faster but restrict the boundary to a hyperplane.
Can One-class SVM handle categorical features?
Not directly. Categorical variables must be encoded numerically (e.g., binary or ordinal encoding) before use, which can introduce distance-metric distortions. For datasets dominated by categorical features, consider tree-based detectors like Isolation Forest instead.
My training set may contain some anomalies. Does that break the model?
Contaminated training data shifts the boundary outward and may cause the model to learn anomalous patterns as normal. One-class SVM is more sensitive to this than Isolation Forest. If contamination is suspected, consider using SVDD with a higher nu or cleaning the training set with a preliminary pass of a fast detector.
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. DOI: 10.1162/089976601750264965 ↗
- Tax, D. M. J., & Duin, R. P. W. (2004). Support vector data description. Machine Learning, 54(1), 45–66. DOI: 10.1023/B:MACH.0000008084.60811.49 ↗
How to cite this page
ScholarGate. (2026, June 3). One-Class Support Vector Machine (Novelty and Anomaly Detection). ScholarGate. https://scholargate.app/en/machine-learning/one-class-svm
Which method?
Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.
- Autoencoder Anomaly DetectionMachine learning↔ compare
- Isolation ForestMachine learning↔ compare
- Local Outlier FactorMachine learning↔ compare