Clustering, density estimation, and anomaly detection · Anomaly detection · UCL063 · Model
Deep Support Vector Data Description (Deep SVDD)
Learn a neural representation in which normal examples concentrate around a fixed center, enabling one-class detection beyond fixed kernels.
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page. The methods that run it are Experimental.
- Deep SVDD (one-class neural anomaly detection) Experimental
Do it in CodeSplash Run it on your own data. It's in the Experimental lane in the app.
- Availability
- Runs in CodeSplash (Experimental)
- 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.deep_svdd. 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
Learn a neural representation in which normal examples concentrate around a fixed center, enabling one-class detection beyond fixed kernels. It is an anomaly-specific representation objective, not a generic autoencoder entry.
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
An encoder with collapse-avoiding constraints and a fixed feature-space center; optional soft boundary.
Assumptions
The original method imposes architectural restrictions to avoid trivial collapse; unrestricted biases or unsuitable activations can undermine the objective. Predominantly normal training data and domain-consistent validation are important.
Formula / computational definition
The one-class form minimizes . A soft-boundary version adds a radius and hinge penalties controlled by . Learned network weights define the representation; center is typically initialized and then fixed.
Parameters and notation
Learned or fitted quantities: Encoder weights and, for the soft-boundary version, radius. User-set hyperparameters/design choices: Architecture, regularization, optimizer, learning rate, center initialization, and preprocessing all matter. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.
Fitting, fine-tuning, and adaptation
Initialize the representation and fixed center on normal reference data, then optimize the one-class or soft-boundary loss. When adapting a pretrained encoder, begin with a frozen-feature baseline, unfreeze selected blocks at a smaller learning rate than a new head, and monitor collapse, normal coverage, and domain shift. Preserve the original architectural restrictions.
How to use and calibrate
Monitor representation variance as well as training loss, evaluate held-out normal coverage and anomaly ranking, and compare with shallow baselines. Lower training radius alone can indicate collapse rather than improvement.
Example application
Learn an anomaly-sensitive representation from predominantly normal images. 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
Authors provide a PyTorch implementation. R can bridge to that code or port the loss with torch, requiring full architecture and training validation. The paired component computes the center loss on supplied embeddings, not a trained neural detector.
Component: Deep SVDD center-loss component. 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 — Deep SVDD center-loss component. · needs numpy
import numpy as np
Z=np.array([[.1,.2],[.2,.1],[.4,.3]]); center=np.array([.2,.2])
result=np.mean(((Z-center)**2).sum(1))
print(result)
Component demo, not a trained model — Deep SVDD center-loss component.
Z=rbind(c(.1,.2),c(.2,.1),c(.4,.3)); center=c(.2,.2)
result=mean(rowSums(sweep(Z,2,center)^2))
print(result)
Sources
- Source 1proceedings.mlr.press
- Source 2github.com
From the CodeSplash reference, entry UCL063.