TabularPTGAN
Guide & worked example · Source
TabularPTGAN(
hidden_dims=(128, 128, 128),
critic_hidden_dims=None,
noise_dim=None,
batch_size=128,
max_steps=1000,
critic_steps=1,
lr=0.0001,
betas=(0.0, 0.9),
optimizer='adam',
temperature_ratio=0.5,
coherency_weight=100.0,
gp_weight=0.0,
interpolate_noise=True,
generator_dropout=0.1,
critic_dropout=0.0,
binary_dims=(),
lower_bounds=None,
upper_bounds=None,
seed=None,
device=None,
)Parallelly tempered Wasserstein GAN for multimodal tabular data.
This implements Algorithm 3 of Sohn and Song (2025), arXiv:2411.11786v2. At each step it learns the joint family of convexly tempered targets alpha * X_1 + (1 - alpha) * X_2 and applies their coherency penalty to synchronize the critic across temperatures. Sampling at alpha=1 returns draws from the original target distribution.
Parameters are mostly shared with :class:TabularWGAN. The PTGAN-specific parameters are temperature_ratio (the point mass on alpha=1), coherency_weight, and interpolate_noise.
Attributes
| Name | Description |
|---|---|
batch_size |
|
betas |
|
binary_dims |
|
coherency_weight |
|
critic_dropout |
|
critic_steps |
|
device |
|
generator_dropout |
|
gp_weight |
|
history |
|
interpolate_noise |
|
lower_bounds |
|
lr |
|
max_steps |
|
noise_dim |
|
optimizer |
|
params |
|
seed |
|
temperature_ratio |
|
upper_bounds |
Methods
| Name | Description |
|---|---|
| fit | Train across convexly tempered target distributions. |
| sample | Draw rows at a requested tempering coordinate. |
| summary | Print a summary of the model results. |
| to | Move all model parameters to specified device. |
fit
TabularPTGAN.fit(X, context=None, callback=None)Train across convexly tempered target distributions.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| X | array-like of shape (n_rows, n_features) | Numeric training rows, converted to float32. Paired rows define the convexly tempered training targets. | required |
| context | array-like of shape (n_rows, n_context) | Aligned conditioning rows. Their interpolation follows the paired-data construction during training. | None |
| callback | callable | Called with the step and model during training. | None |
Returns
| Name | Type | Description |
|---|---|---|
| TabularPTGAN | Self, with fitted networks and loss/penalty histories. |
Notes
This is a GAN objective over tempered laws, not replica-exchange MCMC. The coherency penalty is a squared critic directional derivative along paired data differences. Optional gradient penalties are one-sided.
sample
TabularPTGAN.sample(n, context=None, alpha=1.0)Draw rows at a requested tempering coordinate.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| n | int | Number of requested rows. | required |
| context | array-like of shape (n, n_context) | One conditioning row per draw. | None |
| alpha | float or array - like | Tempering coordinate in [0, 1], scalar or one value per row. The endpoint 1 targets the original data law; interior coordinates target convex combinations of paired rows. | 1.0 |
Returns
| Name | Type | Description |
|---|---|---|
| torch.Tensor | Detached CPU tensor of shape (n, n_features), on training scale. |
summary
TabularPTGAN.summary()Print a summary of the model results.
to
TabularPTGAN.to(device)Move all model parameters to specified device.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| device | torch.device or str | Target device (‘cuda’, ‘cpu’, etc.) | required |
Returns
| Name | Type | Description |
|---|---|---|
| BaseEstimator | Self for method chaining |