CTABGANPlusGenerator<T>

Models & Types · AiDotNet.NeuralNetworks.SyntheticData

CTAB-GAN+ generator for high-quality synthetic tabular data with auxiliary classifier discriminator, mixed-type encoder, and information loss.

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

Implements: ISyntheticTabularGenerator<T>

For Beginners

CTAB-GAN+ works like CTGAN but with smarter training:

**Architecture:**Three-part loss for discriminator:

  1. Wasserstein loss (real vs fake)
  2. Auxiliary classifier loss (correct class prediction)
  3. Gradient penalty (training stability)

Three-part loss for generator:

  1. Fool discriminator (maximize fake score)
  2. Correct class via auxiliary classifier
  3. Information loss (match data statistics)

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

Example usage:

How It Works

This implementation follows the standard neural network architecture pattern with:

  • Proper inheritance from NeuralNetworkBase
  • Layer-based architecture using ILayer components
  • Engine-based tensor operations for CPU/GPU acceleration
  • Full autodiff and JIT compilation support

CTAB-GAN+ extends the CTGAN architecture with:

  • ACGAN-style discriminator: Outputs both real/fake score and class label predictions
  • Information loss: Penalizes statistical divergence between real and generated data
  • Log-frequency encoding: Better handling of long-tail categorical distributions
  • Conditional training: Same training-by-sampling as CTGAN

Reference: “CTAB-GAN: Effective Table Data Synthesizing” (Zhao et al., 2021)

Constructors

Constructor Summary
CTABGANPlusGenerator() Initializes a new CTAB-GAN+ generator with the specified architecture.
CTABGANPlusGenerator(NeuralNetworkArchitecture<T> architecture, CTABGANPlusOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction)

Properties

Property Summary
CTABGANPlusOptions<T> Options { get; } Gets the CTAB-GAN+-specific options.
IReadOnlyList<ColumnMetadata> Columns { get; }
bool IsFitted { get; set; }

Methods

Method Summary
Dictionary<string, T> GetFeatureImportance()
Matrix<T> Generate(int numSamples, Vector<T> conditionColumn, Vector<T> conditionValue) Generates new synthetic tabular data rows.
ModelMetadata<T> GetModelMetadata()
Task FitAsync(Matrix<T> data, IReadOnlyList<ColumnMetadata> columns, int? epochs, CancellationToken ct)
void Fit(Matrix<T> data, IReadOnlyList<ColumnMetadata> columns, int? epochs) Fits the CTAB-GAN+ generator to the provided real tabular data.