Solved – GANS: Using Discriminator for prediction

deep learningmachine learningneural networksone-classunsupervised learning

In the past few years, GANs have been a hot topic and a lot of papers are being published every year regarding GANs. But I always see that either the results of the generator are being shown (sample pictures or anything else generated by the generator) or the feature embeddings are used for other purposes. In some cases, first the GAN is trained with unsupervised data and then the discriminator network is trained with supervised data to predict the output.

What I've never quite seen properly is the use of discriminator to predict a given output. Suppose I have a dataset with points (with N features) of only true class label and I am interested in a sort of one class classification problem. It is not feasible to collect data of the false class label. I am interested to train a GAN with the data points (true class) I have and the generator will obviously generate random samples and so on. So after the GAN is trained, given a new point I want the discriminator to predict whether that point belongs to true class or not.

  1. Is there anything wrong with this approach?
  2. I can't find any decent paper that uses this sort of approach. If anyone knows of any such paper then please provide it in your answer.
  3. Feel free to explain your thoughts on the pros and cons of this approach.

Best Answer

The reason why this approach does not work is that at the end of the training, the discriminator converges to a state when both real and generated data are classified with the same probability, i.e. the discriminator is unable to distinguish between them. Consider the opposite: if the discriminator could still distinguish between real and generated data, you could simply continue improving the generator through the training using this information.

It is nicely described in the Figure 1 of the original paper (Goodfellow et al., 2014: Generative Adversarial Nets):

enter image description here Figure 1: Generative adversarial nets are trained by simultaneously updating the discriminative distribution ($D$, blue, dashed line) so that it discriminates between samples from the data generating distribution (black, dotted line) $p_x$ from those of the generative distribution $p_g$ ($G$) (green, solid line). The lower horizontal line is the domain from which $z$ is sampled, in this case uniformly. The horizontal line above is part of the domain of $x$. The upward arrows show how the mapping $x = G(z)$ imposes the non-uniform distribution $p_g$ on transformed samples. $G$ contracts in regions of high density and expands in regions of low density of $p_g$. (a) Consider an adversarial pair near convergence: $p_g$ is similar to $p_\mathrm{data}$ and $D$ is a partially accurate classifier. (b) In the inner loop of the algorithm $D$ is trained to discriminate samples from data, converging to $D^∗ (x) = \frac{p_\mathrm{data}(x)}{p_\mathrm{data}(x)+p_g(x)}$. (c) After an update to $G$, gradient of $D$ has guided $G(z)$ to flow to regions that are more likely to be classified as data. (d) After several steps of training, if $G$ and $D$ have enough capacity, they will reach a point at which both cannot improve because $p_g = p_\mathrm{data}$. The discriminator is unable to differentiate between the two distributions, i.e. $D(x) = \frac{1}{2}$.

Related Question