OCTGANGenerator<T>

Models & Types · AiDotNet.NeuralNetworks.SyntheticData

OCT-GAN (Kim et al. 2021): a conditional tabular GAN whose generator first maps the noise and condition vector z ⊕ c through a neural ODE, and whose discriminator classifies the trajectory of a neural ODE sampled at learnable time points.

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

Implements: ISyntheticTabularGenerator<T>

For Beginners

A generator invents table rows and a discriminator judges whether rows are real. OCT-GAN lets a hidden vector “flow” smoothly over time in both networks. The generator’s flow turns random noise into a better starting point, so similar noise gives similar rows; the discriminator watches its flow at a few moments it picks itself and judges the row from the whole path.

How It Works

The networks are the paper’s (section 3, dimensions from section 4.1.4):

  • Generator (Eqs. 10-17): p(0) = z ⊕ c, z' = p(0) + ∫₀¹ g(p(t), t) dt with

g = Leaky(FC13(... Leaky(FC6(Norm(p) ⊕ t)))) (eight layers, Norm(p) = p / ‖p‖₂); then two residual blocks h(0) = z' ⊕ ReLU(BN(FC1 z')), h(1) = h(0) ⊕ ReLU(BN(FC2 h(0))); then tanh heads for the mode-normalized values and Gumbel-softmax heads for the modes and the discrete columns.

  • Discriminator (Eqs. 2-9): h(0) = Drop(Leaky(FC2(Drop(Leaky(FC1 x))))); h(t_i) integrates

f = ReLU(BN(FC7(ReLU(BN(FC6(ReLU(BN(h)) ⊕ t)))))) from t_{i-1} to t_i; the trajectory h_x = h(0) ⊕ h(t_1) ⊕ ... ⊕ h(t_m) is scored by FC5(Leaky(FC4(Leaky(FC3 h_x)))).

Training is Algorithm 1: per mini-batch, a WGAN-GP discriminator step that also moves the time points along ∇_{t_i} L_D, then a generator step on L_G + L_matching (the cross-entropy between the condition and the generated discrete column); every learning rate decays by ψ every ξ epochs. As in the authors’ released code, t_0 = 0 and t_m = 1 are fixed, the interior t_1..t_{m-1} share the critic’s Adam, and each is clamped between its neighbours after the step. The authors solve the ODEs with Dormand-Prince and train the time points with the adjoint method; this class uses a fixed-step RK4 (OdeSolverSteps) and differentiates through it, which gives the gradient of Proposition 3.1 for the discretized trajectory. The discriminator reads the row with its condition vector, as in the CTGAN code the paper builds on.

Constructors

Constructor Summary
OCTGANGenerator() Initializes a new OCT-GAN generator with default configuration.
OCTGANGenerator(NeuralNetworkArchitecture<T> architecture, OCTGANOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) Initializes a new OCT-GAN generator with the specified architecture.

Properties

Property Summary
IReadOnlyList<ColumnMetadata> Columns { get; }
OCTGANOptions<T> Options { get; } Gets the OCT-GAN-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)