Clustering, density estimation, and anomaly detection · Anomaly detection · UCL064 · Model
Deep Autoencoding Gaussian Mixture Model (DAGMM)
Jointly learn a compressed representation and a density model, combining latent coordinates with reconstruction-error features.
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 autoencoding Gaussian mixture (DAGMM) 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.dagmm. 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
Jointly learn a compressed representation and a density model, combining latent coordinates with reconstruction-error features. It targets anomalies that are either poorly reconstructed or unlikely under the learned representation density.
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
Compression encoder/decoder, reconstruction-feature concatenation, and a mixture-estimation network.
Assumptions
Joint optimization can collapse or become numerically unstable. Training contamination may be modeled as an ordinary component; high density does not ensure semantic normality.
Formula / computational definition
A typical loss is , where concatenates latent and reconstruction features, is mixture energy, and penalizes degenerate covariance. An estimation network produces soft component assignments used for mixture statistics.
Parameters and notation
Learned or fitted quantities: Neural weights, mixture statistics, and a decision threshold. User-set hyperparameters/design choices: Choose encoder/decoder architecture, latent dimension, mixture count, reconstruction features, loss weights, covariance stabilization, and training schedule. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.
Fitting, fine-tuning, and adaptation
Pretrain or initialize compression carefully, then jointly update compression and estimation networks with reconstruction, energy, and covariance penalties. For adaptation, compare a frozen encoder plus refitted mixture against partial unfreezing at a lower learning rate; recalibrate thresholds after every change. Monitor covariance conditioning and loss balance, not only total loss.
How to use and calibrate
Inspect reconstruction and energy contributions separately, covariance eigenvalues, held-out alert rates, and stability across seeds. Compare with standalone GMM and reconstruction baselines to establish the contribution of joint training.
Example application
Detect anomalies using compressed features plus reconstruction discrepancies. 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 faithful custom PyTorch implementation or a verified author implementation is required; R can bridge or port using torch. The paired component computes a supplied mixture's energy only, not end-to-end DAGMM training.
Component: DAGMM mixture-energy component on scalar compressed features. 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 — DAGMM mixture-energy component on scalar compressed features. · needs numpy, scipy
import numpy as np
from scipy.special import logsumexp
z=np.array([0.,1.,4.]); means=np.array([0.,2.]); variance=np.array([.5,1.]); pi=np.array([.6,.4])
logp=np.log(pi)-.5*np.log(2*np.pi*variance)-.5*(z[:,None]-means)**2/variance
result=-logsumexp(logp,axis=1)
print(result)
Component demo, not a trained model — DAGMM mixture-energy component on scalar compressed features.
z=c(0,1,4); means=c(0,2); variance=c(.5,1); pi=c(.6,.4)
result=sapply(z,function(q) -log(sum(pi*dnorm(q,means,sqrt(variance)))))
print(result)
Sources
- Source 1openreview.net
From the CodeSplash reference, entry UCL064.