SGANs for fraud detection
As the final applied project of this chapter, let's consider the credit card problem again. In this section, we will create an SGAN as follows:
We will train this model on fewer than 1,000 transactions and still get a decent fraud detector.
Note
Note: You can find the code for the SGAN on Kaggle under this link: https://www.kaggle.com/jannesklaas/semi-supervised-gan-for-fraud-detection/code.
In this case, our data has 29 dimensions. We set our latent vectors to have 10Â dimensions:
latent_dim=10 data_dim=29
The generator model is constructed as a fully connected network with LeakyReLU
activations and batch normalization. The output activation is a tanh
activation:
model = Sequential() model.add(Dense(16, input_dim=latent_dim)) model.add(LeakyReLU(alpha=0.2)) model.add(BatchNormalization(momentum=0.8)) model.add(Dense(32, input_dim=latent_dim)) model.add(LeakyReLU(alpha=0.2)) model.add(BatchNormalization(momentum=0.8)) model.add(Dense(data_dim,activation='tanh...