AnoGANDetector<T>

Models & Types · AiDotNet.AnomalyDetection.NeuralNetwork

Implements AnoGAN (Anomaly Detection with Generative Adversarial Networks).

Inheritance: ModelBase<T, Matrix<T>, Vector<T>> → AnomalyDetectorBase<T> → AnoGANDetector<T>

Implements: IGeneratedParameterRegistrar<T>

For Beginners

AnoGAN trains a GAN to generate normal data, then detects anomalies by finding the latent code that best reconstructs a query point. Points that cannot be well-reconstructed are anomalies.

How It Works

The algorithm works by:

  1. Train a GAN (Generator + Discriminator) on normal data
  2. For anomaly scoring, find z that minimizes reconstruction error
  3. Anomaly score combines reconstruction loss and discriminator feature loss

When to use:

  • Image anomaly detection
  • When you have only normal examples for training
  • High-dimensional data where reconstruction quality matters

Industry Standard Defaults:

  • Latent dimensions: 64
  • Hidden dimensions: 128
  • Epochs: 100
  • Learning rate: 0.0002
  • Contamination: 0.1 (10%)

Reference: Schlegl, T., Seeböck, P., Waldstein, S. M., Schmidt-Erfurth, U., and Langs, G. (2017). “Unsupervised Anomaly Detection with Generative Adversarial Networks.” IPMI.

Constructors

Constructor Summary
AnoGANDetector(int latentDim, int hiddenDim, int epochs, double learningRate, int inferenceSteps, double contamination, int randomSeed) Creates a new AnoGAN anomaly detector.

Properties

Property Summary
int HiddenDim { get; } Gets the hidden dimensions.
int LatentDim { get; } Gets the latent dimensions.

Methods

Method Summary
Vector<T> ScoreAnomalies(Matrix<T> X)
void Fit(Matrix<T> X)