Introduction to GAN Principles and Applications

Introduction to GAN Principles and Applications

Selected from StatsBot

Author: Anton Karazeev

Translated by Machine Heart

Contributors: Qianshu, Huang Xiaotian

This article is reproduced with permission from “Machine Heart”

Reproduction prohibited

Generative Adversarial Networks (GANs) are a class of neural networks used in unsupervised learning, which help to solve tasks such as generating images from text, improving image resolution, drug matching, and retrieving specific patterns in images. The Statsbot team invited data scientist Anton Karazeev to introduce the principles and applications of GANs in an easy-to-understand way through everyday examples.

Introduction to GAN Principles and Applications

Generative Adversarial Networks were proposed by Ian Goodfellow in 2014. GANs are not the only approach to applying neural networks in unsupervised learning; there are also Boltzmann Machines (Geoffrey Hinton and Terry Sejnowski, 1985) and Autoencoders (Dana H. Ballard, 1987). All three aim to extract features from data by learning the identity function f(x) = x, and all rely on Markov chains to train or generate samples.

The original intention of GAN design was to avoid using Markov chains, as the latter has a high computational cost. One advantage of GAN over Boltzmann Machines is that GAN has significantly fewer constraints (only a few probability distributions are applicable for Markov chain sampling).

In this article, we will discuss the basic principles of GANs and their most popular real-world applications.

GAN Principles

Let’s explain the principles of GANs using a metaphor.

Introduction to GAN Principles and Applications

Suppose you want to buy a good watch. However, if you’ve never bought a watch before, you might find it hard to distinguish between real and fake; experience in buying watches can help avoid being deceived by unscrupulous sellers. When you start marking most watches as fake (of course after being deceived), sellers will begin to “produce” more realistic counterfeit watches. This example vividly illustrates the basic principle of GANs: the discriminator network (the watch buyer) and the generator network (the seller producing fake watches).

The two networks engage in a game. GANs allow the generation of realistic objects (such as images). The generator is pressured to produce samples that appear real, while the discriminator learns to distinguish between generated samples and real samples.

Introduction to GAN Principles and Applications

What is the difference between the discriminator algorithm and the generator algorithm? Simply put: the discriminator algorithm learns the boundaries between classes (as the discriminator does), while the generator algorithm learns the distribution of classes (as the generator does).

If You Are Ready to Dive Deeper into GANs

To learn the distribution of the generator, you should define the parameters p_g of the data x, as well as the distribution of the input noise variable p_z (z). Then G(z, θ_g) maps z from the latent space Z to the data space, and D(x, θ_d) outputs a single scalar—a probability that x comes from real data rather than p_g.

Train the discriminator to maximize the probability of correctly labeling actual data and generated samples. Train the generator to minimize log(1-D(G(z))). In other words, try to reduce the probability that the discriminator arrives at the correct answer.

This training task can be viewed as a min-max game with a value function V(G, D):

Introduction to GAN Principles and Applications

In other words, the generator strives to generate images that the discriminator finds difficult to identify, while the discriminator becomes increasingly clever to avoid being deceived by the generator.

“Adversarial training is the coolest thing since sliced bread.” – Yann LeCun

When the discriminator cannot distinguish between p_g and p_data, i.e., D(x, θ_d) = 1/2, the training process stops. A balance of the decision error between the generator and the discriminator is achieved.

Historical Archive Image Retrieval

An interesting application of GANs is retrieving similar markers in “Prize Papers,” one of the most valuable archives in maritime history. Adversarial networks make it easier to process these historically significant documents, which also include information about the legality of seizing ships at sea.

Introduction to GAN Principles and Applications

Each queried record contains examples of merchant markers—unique identifiers of merchant attributes, similar to pictograms.

We should obtain feature representations for each marker, but applying conventional machine learning and deep learning methods (including convolutional neural networks) presents some challenges:

  • They require a large number of labeled images;

  • The trademarks are unlabeled;

  • The markers cannot be segmented from the dataset.

This new approach shows how to use GANs to extract and learn features from images of trademarks. After learning the representation for each marker, graphical search can be performed on scanned documents.

Translating Text into Images

Other researchers have shown that generating corresponding images using natural language descriptions is feasible. The method of converting text into images can illustrate the performance of generative models in simulating real data samples.

Introduction to GAN Principles and Applications

The main issue with image generation is that the image distribution is multimodal. For instance, there are too many examples that perfectly match the content of the text description. GANs help address this issue.

Introduction to GAN Principles and Applications

Consider the following task: mapping blue input points to green output points (green points may be the outputs of blue points). The red arrow indicates the prediction error, which also means that after some time, the blue points will be mapped to the average of the green points—this precise mapping will blur the images we are trying to predict.

GANs do not directly use input-output pairs. Instead, they learn how to pair inputs and outputs.

Here is an example of generating images from text descriptions:

Introduction to GAN Principles and Applications

Datasets used to train GANs:

  • Caltech-UCSD-200-2011 is a dataset with 200 types of bird photos, totaling 11,788 images.

  • The Oxford-102 flower dataset consists of 102 flower categories, each containing between 40 and 258 images.

Drug Matching

While other researchers apply GANs to process images and videos, researchers at Insilico Medicine proposed a method for drug matching using GANs.

Our goal is to train the generator to perform drug matching based on diseases as accurately as possible from an existing drug database.

Introduction to GAN Principles and Applications

After training, the generator can obtain prescriptions for previously incurable diseases and use the discriminator to determine whether the generated prescription cures a specific disease.

Applications in Tumor Molecular Biology

Another study by Insilico Medicine shows the generation of a pipeline for new anti-cancer molecules defined by parameters. The aim is to predict drug responses and compounds with anti-cancer properties.

Researchers proposed an Adversarial Autoencoder (AAE) model based on existing biochemical data for identifying and generating new compounds.

Introduction to GAN Principles and Applications

“To our knowledge, this is the first application of GAN technology in the field of cancer drug discovery,” researchers said.

There are many available biochemical data in the database, such as the Cancer Cell Line Encyclopedia (CCLE), Genomics of Drug Sensitivity in Cancer (GDSC), and NCI-60 cancer cell lines. All of these contain screening data for different drug experiments against cancer.

Introduction to GAN Principles and Applications

The Adversarial Autoencoder takes drug concentrations and fingerprints as inputs and uses growth inhibition rate data for training (GI, showing the reduction in the number of cancer cells after treatment).

Molecular fingerprints are represented in computers with a fixed number of bits, where each bit represents the retention state of certain features.

Introduction to GAN Principles and Applications

The hidden layer consists of 5 neurons, one of which is responsible for GI (cancer cell inhibition rate), and the other 4 are determined by a normal distribution. Thus, a regression term is added to the encoder’s cost function. Additionally, the encoder can only map the same fingerprint to the same latent vector, a process independent of the input through additional manifold cost concentration.

Introduction to GAN Principles and Applications

After training, the network can generate molecules from the desired distribution and use the GI neurons as fine-tuners for the output compounds.

The results of this work are as follows: compounds predicted by the trained AAE model have been proven to be anti-cancer drugs, as well as new drugs that require experimental validation for anti-cancer activity.

“Our findings indicate that the AAE model proposed in this paper significantly improves the efficiency of developing specific anti-cancer capabilities and new molecules using deep generative models.”

Conclusion

Unsupervised learning is the next blue ocean in artificial intelligence, and we are moving in that direction.

Generative Adversarial Networks can be applied in many fields, from generating images to predicting drugs, so do not be afraid of failure. We believe GANs will help build a better future for machine learning.Introduction to GAN Principles and Applications

Original link: https://blog.statsbot.co/generative-adversarial-networks-gans-engine-and-applications-f96291965b47

Long press the QR code below to subscribe for free!

C2

How to Join the Society

Register as a member of the society:

Individual Member:

Follow the society’s WeChat: China Command and Control Society (c2_china), reply “Individual Member” to obtain the membership application form, fill it out as required, and if you have questions, you can leave a message in the public account. You can pay the membership fee online via Alipay after passing the society’s review.

Unit Member:

Follow the society’s WeChat: China Command and Control Society (c2_china), reply “Unit Member” to obtain the membership application form, fill it out as required, and if you have questions, you can leave a message in the public account. You can pay the membership fee after passing the society’s review.

Recent Activities of the Society

1. CICC Enterprise Member Exchange Meeting

Meeting Time: (Specific time will be notified later)

2. 2017 First National Wargaming Competition Finals

September 25, 2017

Long press the QR code below to follow the society’s WeChat

Introduction to GAN Principles and Applications

Thank you for your attention

Leave a Comment