VAEDetector<T>
Models & Types · AiDotNet.AnomalyDetection.NeuralNetwork
Detects anomalies using Variational Autoencoder (VAE).
Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → VAEDetector<T>
Implements: IGeneratedParameterRegistrar<T>
For Beginners
A VAE is a generative neural network that learns to encode data into a lower-dimensional probabilistic latent space and decode it back. Anomalies are points that are poorly reconstructed or fall in low-probability regions of the latent space.
How It Works
The algorithm works by:
- Train encoder to map data to latent distribution (mean + variance)
- Train decoder to reconstruct from latent samples
- Score combines reconstruction error and KL divergence
When to use:
- Complex, high-dimensional data
- When you want probabilistic anomaly scores
- Image, text, or structured data anomalies
Industry Standard Defaults:
- Latent dimensions: 10
- Hidden dimensions: 64
- Learning rate: 0.001
- Epochs: 100
- Contamination: 0.1 (10%)
Reference: Kingma, D.P., Welling, M. (2014). “Auto-Encoding Variational Bayes.” ICLR. An, J., Cho, S. (2015). “Variational Autoencoder based Anomaly Detection.”
Constructors
| Constructor | Summary |
|---|---|
VAEDetector(int latentDim, int hiddenDim, int epochs, double learningRate, double contamination, int randomSeed) |
Creates a new VAE anomaly detector. |
Properties
| Property | Summary |
|---|---|
int HiddenDim { get; } |
Gets the hidden layer dimensions. |
int LatentDim { get; } |
Gets the latent space dimensions. |
Methods
| Method | Summary |
|---|---|
Vector<T> ScoreAnomalies(Matrix<T> X) |
|
void Fit(Matrix<T> X) |