Generative adversarial networks
In this article, we will explore the concept of Generative Adversarial Networks (GANs), their components, working mechanisms, and various types. We will then delve into how GANs can be implemented for credit card fraud detection, followed by a look at other applications of GANs.
Generative adversarial networks (GANs) are among the most popular and recent unsupervised machine learning innovations developed by Ian J. Goodfellow in 2014.GAN is a class of algorithmic machine learning framework having two neural networks that connect and can analyze, capture and copy the variations within a dataset. Further, both neural networks work against one another in GAN machine learning, hence called adversarial networks.
- Generative: Explains how data is generated visually
- Adversarial: Model is trained in an adversarial training as two networks compete each other.
- Networks: Uses deep neural networks as AI algorithms for training.
Components of GAN:
- Generator Network:The generator network’s purpose is to generate new data samples that resemble the training data. It takes random noise as input and produces various types of data samples, such as images, text, or audio.
- Discriminator Network:The discriminator network’s purpose is to distinguish between real data and data generated by the generator. It receives both real data from the training set and fake data from the generator as input. The output is a probability indicating whether the input data is real or fake. The primary objective of the discriminator is to correctly identify real versus generated data.
- Loss Functions:Generative Adversarial Networks (GANs) utilize loss functions to train both the generator and the discriminator. The loss function helps adjust the weights of these models during training to optimize their performance. Both the generator and the discriminator use the binary cross-entropy loss to train the models, that can be written as
where:
L(y,p) is the loss value;
y is the true label (either 0 or 1);
p is the predicted probability of the sample belonging to class 1. - Generator Loss: The generator’s goal is to produce samples that the discriminator incorrectly classifies as real. Its loss is typically represented as:
This term penalizes the generator when the discriminator correctly identifies its outputs as fake. - Discriminator Loss: The discriminator’s goal is to correctly classify real samples as real and fake samples (produced by the generator) as fake.
Its loss is typically represented as: - Random Noise Input:Random noise serves as the input to the generator network. It is usually a vector of random values sampled from a uniform or normal distribution. This noise provides the generator with a diverse set of inputs, enabling it to produce varied data samples.
Working of GAN:
- The generator neural network analyzes the training set and identifies data attributes
- The discriminator neural network also analyzes the initial training data and distinguishes between the attributes independently
- The generator modifies some data attributes by adding noise (or random changes) to certain attributes
- The generator passes the modified data to the discriminator
- The discriminator calculates the probability that the generated output belongs to the original dataset
- The discriminator gives some guidance to the generator to reduce the noise vector randomization in the next cycle
The generator attempts to maximize the probability of mistake by the discriminator, but the discriminator attempts to minimize the probability of error. In training iterations, both the generator and discriminator evolve and confront each other continuously until they reach an equilibrium state. In the equilibrium state, the discriminator can no longer recognize synthesized data. At this point, the training process is over.
Types of GANs:
- Vanilla GAN: This is the simplest of all GANs and its algorithm tries to optimize the mathematical equation using stochastic gradient descent, which is a method of learning an entire data set by going through one example at a time.
- Conditional GAN (CGAN): CGAN can be described as a deep learning method in which some conditional parameters are put into place, an additional parameter ‘y’ is added to the Generator for generating the corresponding data.
- Deep convolutional GAN (DCGAN): It is implemented with help of ConvNets in place of a Multi-layered perceptron. They are more stable and generate better quality images.
- Super-resolution GAN (SRGAN): focus on upscaling low-resolution images to high resolution.
- Cycle GAN: It is used to perform image translation.
Usage of GAN for credit card fraud detection
To implement a GAN for credit card fraud detection, generate synthetic normal transactions and then using a combination of real and synthetic data to train the model.
- Data preprocessing: Clean data, scale data, split into training and testing sets.
- GAN architecture: Define the architecture, generator, discriminator. Generator
- Compile models: With appropriate loss functions and optimizers
- Train generator and discriminator alternatively.
- Generate synthetic data using the generator
- Combine real and synthetic data to train the model
- Implement and evaluate the model using evaluation metrics
Applications:
- Image generation
- Enhancing low-resolution images
- Style Transfer
- Generating Art
Summary
Generative Adversarial Networks (GANs) are a powerful tool in the field of unsupervised machine learning, capable of generating synthetic data that closely resembles real data. GANs consist of a generator and a discriminator network, working adversarially to improve data generation. By using GANs, we can enhance datasets for various applications, including credit card fraud detection. Implementing GANs for fraud detection involves data preprocessing, defining GAN architecture, training the GAN, generating synthetic data, and evaluating the model’s performance. GANs have diverse applications beyond fraud detection, such as image generation, enhancing low-resolution images, style transfer, and art creation.
References:
Paper by Ian Goodfellow, developer of GAN, https://arxiv.org/pdf/1406.2661
Article by R.V.S.Krishna Dutt and P.Premchand https://cvr.ac.in/ojs/index.php/cvracin/article/view/38/21
Paper on Synthetic Data Generation for Fraud Detection using GANs : https://arxiv.org/pdf/2109.12546
Recent Comments