Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Learning “normal” without examples of failure
Spacecraft rarely fail, so you may have months of nominal telemetry and no examples of the faults you care about. A one-class SVM draws a boundary around the nominal data and calls everything outside it novel. One knob, ν, says what fraction of the training data you are willing to treat as unusual. The RBF width γ decides how tightly the boundary hugs the data: one loose blob, or a separate island for each operating mode.
One-class methods power fault and anomaly detection when faults are rare, unlabeled or unforeseen. Examples include spacecraft housekeeping telemetry, rotating machinery vibration, network intrusion and manufacturing inspection. They need only nominal data, which is plentiful.
- 1. A one-class SVM is trained on…
- 2. ν roughly controls…
- 3. In the demo, too small a γ makes the region…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.A two-point example
Setup. Take two training points with RBF kernel values k(x₁, x₁) = k(x₂, x₂) = 1 and k(x₁, x₂) = 0.6, and ν = 1, so each αᵢ ≤ 1/(νn) = 0.5.
- The constraint Σα = 1 forces α = (0.5, 0.5).
- Offset: ρ = (Kα)₁ = 0.5·1 + 0.5·0.6 = 0.8.
- Training point x₁: f(x₁) = 0.8 − 0.8 = 0, exactly on the boundary.
- New point with kernel value 0.3 to both: f = 0.5·0.3 + 0.5·0.3 − 0.8 = −0.5, so it is flagged as novel.
- New point halfway between, with kernel value 0.9 to both: f = 0.9 − 0.8 = 0.1, so it is normal.
Ball picture (SVDD). For the RBF kernel every point has φ(x)·φ(x) = 1, so all points lie on a sphere in feature space. Separating them from the origin with a hyperplane is then the same as enclosing them in the smallest ball. Novel points are those outside the ball.
The steps in plain English:
- Collect nominal data only, and standardise the features.
- Choose ν (an upper bound on the fraction of training points that may fall outside) and γ.
- Solve the dual: minimise ½αᵀKα subject to 0 ≤ αᵢ ≤ 1/(νn) and Σα = 1.
- Compute ρ from free support vectors and score new points with f(x) = Σαᵢk(xᵢ, x) − ρ.
- Flag f(x) below 0, or rank by −f(x) and set a threshold on a validation set.
- 1. Upper bound on αᵢ for ν = 0.1 and n = 50?
- 2. A point with f(x) = −0.5 is…
- 3. For the RBF kernel the one-class SVM is equivalent to…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 35 minUndergraduate students and practising engineers.The formulations
Schölkopf et al. (2001), primal. Minimise ½‖w‖² + (1/(νn))·Σξᵢ − ρ subject to w·φ(xᵢ) ≥ ρ − ξᵢ and ξᵢ ≥ 0. The decision function is f(x) = w·φ(x) − ρ.
Dual. Minimise ½αᵀKα subject to 0 ≤ αᵢ ≤ 1/(νn) and Σαᵢ = 1. Then f(x) = Σαᵢk(xᵢ, x) − ρ.
SVDD (Tax and Duin, 2004). Find the smallest ball, with centre c and radius R, containing most points: minimise R² + C·Σξᵢ subject to ‖φ(xᵢ) − c‖² ≤ R² + ξᵢ.
- Its dual is maximise Σαᵢkᵢᵢ − αᵀKα with the same constraints when C = 1/(νn).
- When kᵢᵢ is constant (the RBF kernel), Σαᵢkᵢᵢ is constant, so the two problems coincide.
ν-property. Fraction of training outliers ≤ ν ≤ fraction of support vectors, by the same counting as on the ν-SVM page.
Solvers. SMO-style pair updates (LIBSVM) or projected gradient. Exercise 1 uses accelerated projected gradient (FISTA). It projects onto the “capped simplex” with a bisection on a scalar shift.
| Detector | Assumes | Strength | Weakness |
|---|---|---|---|
| Mahalanobis (one Gaussian) | one elliptical mode | fast, interpretable | fails on multi-modal data |
| k-NN distance | local density | flexible, almost no tuning | slow at test time; sensitive to scaling |
| Isolation forest | anomalies are easy to isolate | scales well | axis-aligned splits |
| One-class SVM | smooth support region | kernel flexibility, ν control | γ is sensitive; O(n²) memory |
from sklearn.svm import OneClassSVM
det = make_pipeline(StandardScaler(), OneClassSVM(kernel="rbf", nu=0.05, gamma=1.0)).fit(X_nominal)
det.decision_function(X_new) # < 0: novel- 1. The one-class SVM dual's equality constraint is…
- 2. SVDD and the one-class SVM coincide when…
- 3. A single-Gaussian Mahalanobis detector fails when the normal data are…
Level 3: Advanced
★★★★☆ Advanced⏱ 30 minGraduate level, with full derivations and proofs.Theory
What it estimates. Schölkopf et al. (2001) showed that the one-class SVM estimates a region containing a fraction about 1 − ν of the probability mass with small “volume” in the RKHS sense. That is a minimum-volume set or density level set. It is not a density estimate, so its scores are reliable near the boundary but not as a ranking deep inside the data.
The plateau. Points with αᵢ = 0 have f(xᵢ) ≥ 0 and free SVs have f = 0 exactly. With a wide kernel the score is therefore almost flat (close to 0) throughout the interior. Exercise 1 found f(0, 0) = −0.0004 at the centre of a Gaussian cloud. As a result, ranking normal points by f is noisy, and AUC suffers when anomalies sit near or inside the support, such as the gap between two modes.
Choosing γ and ν.
- γ is the critical parameter. Too small merges modes (exercise 2: AUC 0.73 on gap anomalies at γ = 0.1). Too large overfits individual points.
- Without anomalies to validate on, heuristics include: choose γ so that a small fraction of held-out nominal points are rejected (close to ν), or maximise a proxy such as the stability of the boundary.
- ν should match the expected contamination of the “nominal” training set.
Interview questions.
- How do you validate a novelty detector with no fault examples? Use held-out nominal data to check the false-alarm rate (it should be close to ν), inject synthetic faults, and review flagged events with experts.
- Why might k-NN beat a one-class SVM? The data are low-dimensional with complex local structure, k-NN needs no γ, and the OCSVM’s plateau weakens ranking.
- 1. The one-class SVM estimates…
- 2. Inside the data the OCSVM score is often…
- 3. Which parameter is most critical?
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Novelty detection on two-mode telemetry
History.
- Schölkopf, Platt, Shawe-Taylor, Smola and Williamson (2001) introduced the one-class SVM and its ν-property.
- Tax and Duin (1999, 2004) introduced SVDD.
- Applications spread to machinery fault detection, intrusion detection and spacecraft telemetry.
- Isolation forest (Liu, Ting and Zhou, 2008) and deep one-class methods (Deep SVDD, Ruff et al., 2018) followed, keeping the one-class idea.
Exercise 1.
- The ν-property held: 0.000 ≤ 0.05 ≤ 0.188, 0.138 ≤ 0.2 ≤ 0.275 and 0.475 ≤ 0.5 ≤ 0.525.
- Scores never rose along a ray leaving the data, and a point at (4, 4) scored −0.198.
- At the cloud’s centre the score was −0.0004. With γ = 0.5 the score is almost flat inside the data, so the centre sits on the plateau, technically just below 0.
Exercise 2. Setup: nominal data from two operating modes (n = 200), test data with 200 nominal points, 60 “gap” anomalies between the modes and 60 “far” anomalies. ν = 0.05. The table shows ROC AUC averaged over 3 seeds.
| Detector | gap anomalies | far anomalies |
|---|---|---|
| OCSVM, γ = 0.1 | 0.725 | 1.000 |
| OCSVM, γ = 1 | 0.936 | 1.000 |
| OCSVM, γ = 10 | 0.962 | 0.999 |
| Mahalanobis (one Gaussian) | 0.056 | 0.984 |
| 5-NN distance | 0.988 | 1.000 |
- Far anomalies are easy. Every detector scored at least 0.98.
- Gap anomalies separate the methods. A single Gaussian puts its centre in the gap, so it ranks gap anomalies as the most normal points of all (AUC 0.056, far below chance).
- The OCSVM needs a large enough γ to split the two modes. It improved from 0.73 to 0.96 as γ grew.
- The simple 5-NN distance was best (0.988) in this low-dimensional setting. The OCSVM’s score plateau weakens its ranking. In higher dimensions, or with very large n, the comparison can change.
One-class SVMs in AI, robotics and aerospace
- Spacecraft telemetry monitoring: learn nominal housekeeping behaviour per operating mode and flag departures.
- Machinery health: bearing and gearbox vibration features from healthy runs.
- Robot safety: detect out-of-distribution sensor inputs before a learned controller acts on them.
- Deep SVDD: the same objective applied to neural-network features for images.
References
- B. Schölkopf, J. C. Platt, J. Shawe-Taylor, A. J. Smola, R. C. Williamson (2001). “Estimating the support of a high-dimensional distribution.” Neural Computation 13(7).
- D. M. J. Tax, R. P. W. Duin (2004). “Support vector data description.” Machine Learning 54.
- F. T. Liu, K. M. Ting, Z.-H. Zhou (2008). “Isolation forest.” ICDM.
- L. Ruff et al. (2018). “Deep one-class classification.” ICML.
- M. A. F. Pimentel, D. A. Clifton, L. Clifton, L. Tarassenko (2014). “A review of novelty detection.” Signal Processing 99.