# Can a GAN-like architecture be used for maximizing the value of a regression predictor?

I can't seem to convince myself why a GAN model similar to regGAN couldn't be modified to maximize a regression predictor (see the image below). By changing the loss function to the difference between the current predicted value and the maximum predicted value generated so far, wouldn't gradient decent converge such that the generator builds the inputs that will maximize the prediction in the Discriminator CNN?

In math terms, the loss calculation would look like:

  yhat = current prediction
ymax = best prediction achieved yet
Loss = ymax - yhat
if Loss < 0 then Loss = 0; ymax = yhat
Back-propagate the loss using SGD


If the current predicted value is higher than the maximum predicted so far, then the loss is 0 and the loss function is updated. Essentially, we are changing the objective from generating inputs that look real to generating inputs that optimize the complex function encoded in the CNN. • Note: I expect that there is a reason that the answer to my question is "No, you can't do that", but my limited knowledge on the subject matter is keeping me from figuring that out. – Ryan Gross May 24 '18 at 18:44
• After having more time to think about it, I'm guessing the problem may be that the lack of a true discriminator would allow the generator to produce highly unrealistic examples that maximize the regression function. – Ryan Gross Sep 24 '18 at 5:55
• Regarding your last comment, that's not 100% true. You do have a "discriminator", it's just not a network. If I understand your question correctly, you can just use a standard algorithm (or even hard-coded stuff) to create your discriminator. If you go down that road, you would need to maybe get away from the frameworks you mentioned and just build your own quasi framework. After all, GAN is more of a "concept" and approach than it is a framework. – I_Play_With_Data Oct 16 '18 at 19:41
• @Unknown Coder: if you expound on that comment in an answer, I’ll award you the bounty on the question. – Ryan Gross Oct 17 '18 at 22:51

Note that GANs are generally considered either as a way to perform implicit density estimation or defined by the game-theoretic minimax problem they usually imply. The situation you're describing doesn't really seem to fit in either of those, especially the latter, because your generator $$G$$ and $$D$$ are not really working against each other; rather, they are working together to maximize the function you are optimizing. In other words, the situation you're describing seems to simply be doing generation that maximizes some objective (in a somewhat complicated manner it appears), rather than realism. Since the objective is readily directly computable (as far as I can tell), we can just do standard optimization maximizing it. The reason why the alternating GAN optimization is needed is because the specific objective of realism is not directly computable nor optimizable without first training the critic.
Nevertheless, combining GANs and regression is quite sensible, so maybe I'm misunderstanding your question and notation. Let $$X$$ be the data space, and let $$f:X\rightarrow\mathbb{R}$$ be the true value of the function you are trying to maximize (after regressing). Let $$R:X\rightarrow\mathbb{R}$$ denote a learned regression function approximating $$f$$. Denote $$G:\mathcal{U}\rightarrow X$$ as the generator and $$D:X\rightarrow[0,1]$$ as the critic (discriminator), aiming for realism. Let me consider two possibly relevant scenarios, assuming a dataset $$(x_i,f_i)$$:
1. Simply directly optimize a GAN with an additional loss term maximizing $$f$$: $$\mathcal{L}(G) = (1-\eta)\mathbb{E}_{x\sim G}[\log D(x)] + \eta \mathbb{E}_{x\sim G}[R(x)]$$ for the generator. We can optimize $$D$$ and $$R$$ in the standard way together. In other words, we are telling $$G$$ to generate $$x\in X$$ that balance realism and high $$f$$, with the balance controlled by $$\eta\in[0,1]$$. When $$\eta=0$$, it is a regular GAN (not caring about $$f$$); when $$\eta=1$$, the critic is not used at all and there is no regard for realism - $$G$$ will learn to generate random samples that maximize $$f$$ without caring about how realistic they are (i.e., without matching the true distribution $$p(x)$$).
2. Separately, train the regressor $$R$$ and the GAN generator $$G$$. Then we can generate a high $$f$$ data point by gradient descent in the GAN latent space, i.e. doing: $$u_t \leftarrow u_{t-1} +\xi \nabla_u R(G(u_{t-1}))$$ so that our output $$x=G(u_T)$$ has high $$f(x)$$. Since $$u$$ is in the GAN latent space, we expect $$x$$ to be realistic as well.
In both of these simple scenarios, we are using the GAN to maintain realism, while maximizing $$f$$. Notice that if we don't care about realism then the GAN is not needed at all. Simply generating samples does not make a model a GAN: there are many generative models, such as Deep Boltzmann machines, VAEs, etc... that can do this. What sets GANs apart is adversarial learning, where two networks work against each other, and it's not clear that's happening in the case you described.