Clustering, density estimation, and anomaly detection · Anomaly detection · UCL057 · Model
Support Vector Data Description (SVDD)
Describe normal data with a small enclosing sphere in feature space, allowing slack for exceptions. It offers a geometric one-class model distinct from the separating-hyperplane formulation of one-class SVM.
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page.
- One-class SVM Verified in Python and R
Do it in CodeSplash Run it on your own data, in Python or R.
- Availability
- Runs in CodeSplash
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through discover.ocsvm. The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Describe normal data with a small enclosing sphere in feature space, allowing slack for exceptions. It offers a geometric one-class model distinct from the separating-hyperplane formulation of one-class SVM.
Question / hypotheses
Which observations deviate from the chosen reference notion of normality, and at what operational alert rate? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.
Architecture / computational structure
A minimum-radius feature-space ball with slack or its kernel dual.
Assumptions
For certain translation-invariant kernels SVDD and one-class SVM are closely related, but arbitrary settings or kernels do not make them identical. A contaminated reference set can inflate or distort the sphere.
Formula / computational definition
Minimize subject to , . Learned center and radius define acceptance; controls slack cost. Kernelization allows nonlinear boundaries in the original coordinates.
Parameters and notation
Learned or fitted quantities: Sphere center, radius, support coefficients, and slack variables. User-set hyperparameters/design choices: Set kernel, bandwidth, regularization, scaling, and optimization tolerance. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.
Fitting, fine-tuning, and adaptation
Neural fine-tuning is not applicable to this classical detector. Refit the reference model when its population changes, then recalibrate an alert threshold on a separate normal holdout. Tune sensitivity without using final-test anomaly labels repeatedly.
How to use and calibrate
Check held-out normal coverage, detection at a fixed alert budget, support-vector behavior, and sensitivity to kernel choices. Squared distance minus radius is a score, not a calibrated probability.
Example application
Represent an accepted operating region as a compact feature-space sphere. Define the reference population, measurement units, and success criterion before fitting; investigate whether discovered groups or alerts reflect the intended phenomenon.
Interpretation / pitfalls
Watch out
The reported result is conditional on the representation and objective. An alert is a screening result, not a diagnosis or a calibrated posterior probability. Evaluate both ranking and the decision threshold.
Python and R code examples
A custom quadratic program is needed for the exact kernel SVDD formulation unless a separately verified implementation is selected. The portable component evaluates a supplied feature-space sphere; it does not claim that a sample mean is the optimized SVDD center.
Component: SVDD supplied feature-space sphere score. Python: executed successfully; R: not executed (Rscript unavailable). These small fixtures establish the arithmetic operation, not full-method accuracy or reproduction of paper results.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — SVDD supplied feature-space sphere score. · needs numpy
import numpy as np
Z=np.array([[0.,0.],[1.,1.],[3.,0.]]); center=np.array([.5,.5]); radius=1.
result=((Z-center)**2).sum(1)-radius**2
print(result)
Component demo, not a trained model — SVDD supplied feature-space sphere score.
Z=rbind(c(0,0),c(1,1),c(3,0)); center=c(.5,.5); radius=1
result=rowSums(sweep(Z,2,center)^2)-radius^2
print(result)
Sources
- Source 1rduin.nl
From the CodeSplash reference, entry UCL057.