MisGANGenerator<T>

Models & Types · AiDotNet.NeuralNetworks.SyntheticData

MisGAN generator for learning from incomplete data using dual generator/discriminator pairs for both data values and missingness patterns.

Inheritance: NeuralNetworkBase<T> → NeuralSyntheticTabularGeneratorBase<T> → MisGANGenerator<T>

Implements: ISyntheticTabularGenerator<T>

For Beginners

MisGAN handles datasets with missing values:

Real datasets often have missing values (e.g., patients who skip blood tests, customers who don’t fill in all survey questions). MisGAN learns two things:

  1. What the complete data looks like (the data generator)
  2. Which values tend to be missing (the mask generator)

The data discriminator only sees observed values (masking out missing ones), just like in real life. This forces the data generator to produce realistic complete rows, even though it only gets feedback on partial observations.

If you provide custom layers in the architecture, those will be used directly for the data generator network. If not, the network creates industry-standard MisGAN layers based on the original research paper specifications.

Architecture:

Training loop (per batch):

Example usage:

How It Works

MisGAN uses a dual-GAN architecture with four networks:

  • Data generator (G_x): Generates complete data rows from noise
  • Data discriminator (D_x): Judges masked data (only observed values) as real or fake
  • Mask generator (G_m): Generates realistic missingness patterns from noise
  • Mask discriminator (D_m): Judges missingness patterns as real or fake

Key innovations:

  • Masked discrimination: D_x only sees data * mask (observed values), not complete rows
  • Missingness modeling: G_m learns the missing data mechanism (MCAR/MAR/MNAR)
  • WGAN-GP training: Both discriminators use Wasserstein distance with gradient penalty
  • Residual generators: Skip connections for better gradient flow

This implementation follows the standard neural network architecture pattern with:

  • Proper inheritance from NeuralNetworkBase
  • Layer-based architecture using ILayer components
  • Full autodiff and JIT compilation support

Reference: “MisGAN: Learning from Incomplete Data with GANs” (Li et al., ICLR 2019)

Constructors

Constructor Summary
MisGANGenerator() Initializes a new MisGAN generator with the specified architecture.
MisGANGenerator(NeuralNetworkArchitecture<T> architecture, MisGANOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction)

Properties

Property Summary
IReadOnlyList<ColumnMetadata> Columns { get; }
MisGANOptions<T> Options { get; } Gets the MisGAN-specific options.
bool IsFitted { get; set; }

Methods

Method Summary
Dictionary<string, T> GetFeatureImportance()
Matrix<T> Generate(int numSamples, Vector<T> conditionColumn, Vector<T> conditionValue)
ModelMetadata<T> GetModelMetadata()
Task FitAsync(Matrix<T> data, IReadOnlyList<ColumnMetadata> columns, int? epochs, CancellationToken cancellationToken)
void Fit(Matrix<T> data, IReadOnlyList<ColumnMetadata> columns, int? epochs)
void SetTrainingMode(bool isTraining)