TVAEGenerator<T>
Models & Types · AiDotNet.NeuralNetworks.SyntheticData
Tabular Variational Autoencoder (TVAE) for generating synthetic tabular data.
Inheritance: NeuralNetworkBase<T> → NeuralSyntheticTabularGeneratorBase<T> → TVAEGenerator<T>
Implements: ISyntheticTabularGenerator<T>
For Beginners
TVAE works like a compression algorithm that can also generate new data:
**Training (learning to compress and decompress):**Generation (creating new data):
The key insight is that the latent space is regularized to be Gaussian, so we can sample random points from it and decode them into realistic rows.
If you provide custom layers in the architecture, those will be used directly for the encoder network. If not, the network creates industry-standard TVAE layers based on the original research paper specifications.
Example usage:
How It Works
TVAE applies the VAE framework to tabular data with the same VGM preprocessing as CTGAN:
- Encoder: Maps transformed data row to latent distribution parameters (mean, logvar)
- Reparameterization: z = mean + exp(0.5 * logvar) * epsilon (epsilon ~ N(0,1))
- Decoder: Reconstructs the transformed data from the latent code
- ELBO Loss: Reconstruction loss (per-column cross-entropy/MSE) + KL divergence
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
Reference: “Modeling Tabular Data using Conditional GAN” (Xu et al., NeurIPS 2019)
Constructors
| Constructor | Summary |
|---|---|
TVAEGenerator() |
Initializes a new TVAE generator with the specified architecture. |
TVAEGenerator(NeuralNetworkArchitecture<T> architecture, TVAEOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Properties
| Property | Summary |
|---|---|
IReadOnlyList<ColumnMetadata> Columns { get; } |
|
TVAEOptions<T> Options { get; } |
Gets the TVAE-specific options. |
bool IsFitted { get; set; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> GetFeatureImportance() |
|
Matrix<T> Generate(int numSamples, Vector<T> conditionColumn, Vector<T> conditionValue) |
Generates synthetic tabular data samples. |
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 TVAE generator to the provided real tabular data. |