TabularWGAN

Guide & worked example · Source

TabularWGAN(
    hidden_dims=(128, 128, 128),
    critic_hidden_dims=None,
    noise_dim=None,
    batch_size=128,
    max_steps=1000,
    critic_steps=5,
    lr=0.0001,
    betas=(0.5, 0.9),
    optimizer='adam',
    gp_weight=5.0,
    generator_dropout=0.1,
    critic_dropout=0.0,
    binary_dims=(),
    lower_bounds=None,
    upper_bounds=None,
    seed=None,
    device=None,
)

Wasserstein GAN with gradient penalty for tabular simulation.

Attributes

Name Description
batch_size
betas
binary_dims
critic_dropout
critic_hidden_dims
critic_steps
device
generator_dropout
gp_weight
hidden_dims
history
lower_bounds
lr
max_steps
noise_dim
optimizer
params
seed
upper_bounds

Methods

Name Description
fit Train a tabular generator and critic on numeric rows.
sample Draw rows from the trained WGAN.
summary Print a summary of the model results.
to Move all model parameters to specified device.

fit

TabularWGAN.fit(X, context=None, callback=None)

Train a tabular generator and critic on numeric rows.

Parameters

Name Type Description Default
X array-like of shape (n_rows, n_features) Training rows, converted to float32 on the selected device. Standardization or schema transformations are the caller’s job. required
context array-like of shape (n_rows, n_context) Conditioning covariates aligned with the training rows. The model does not learn the marginal distribution of these covariates. None
callback callable Called with the step and fitted object during training; useful for recording diagnostics without changing the objective. None

Returns

Name Type Description
TabularWGAN Self, with trained networks and critic/generator loss histories.

Notes

The critic penalty is one-sided: squared excess of gradient norm above one. Binary output coordinates and numeric bounds constrain network output; they are not a mixed-data likelihood or privacy guarantee.

sample

TabularWGAN.sample(n, context=None)

Draw rows from the trained WGAN.

Parameters

Name Type Description Default
n int Number of generated rows. required
context array-like of shape (n, n_context) One context row per draw, using the training representation. None

Returns

Name Type Description
torch.Tensor Detached CPU tensor of shape (n, n_features). Values remain on the training scale; apply inverse preprocessing separately.

summary

TabularWGAN.summary()

Print a summary of the model results.

to

TabularWGAN.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