Training Models and Generating Artificial Data

Training Models

The function train trains the WGAN model, which is made up of the Generator and Critic (discriminator). If context is non-empty, a cWGAN is trained, otherwise the default is a regular WGAN. The function is trained using stochastic optimization as described in detail in Gulrajani et al 2017.

wgan.train(generator, critic, x, context, specs)

Generating Artificial Data

The function apply_generator from class DataWrapper replaces columns in df that are produced by the generator. The generated data is of size equal to the number of rows in df. Variables in df that are not produced by the generator are not modified.

df_generated contains the artificially generated data.

df_generated = data_wrapper.apply_generator(generator, df.sample(int(1e6), replace=True))