Answers.Body: <p>The formal name for this difference is &quot;generative&quot; vs &quot;discriminative&quot; models.</p>
  <p>By default, a supervised learning process using a simple feed-forward neural network and a set of training data with expected answers will produce a discriminative model. It is hard to use such a model to generate content directly.</p>
  <p>Differences between discriminative and generative models tend to be at the architecture level or deeper, although a few generative techniques are simple variants or re-purposing of discriminative networks. There is no single &quot;fundamental&quot; difference in terms of NN design. About the only common theme is that generative models are more complex and harder to work with than discriminative ones.</p>
  <h2>Images</h2>
  <ul>
  <li><p>Probably the most popular currently for image generation are <a href="https://skymind.ai/wiki/generative-adversarial-network-gan" rel="nofollow noreferrer">Generative Adversarial Networks or GANs</a>. These train a Generator to create an image from random inputs, alongside a Discriminator that tries to spot fakes compared to real images. Training them together results in a generator network that gets progressively better at creating fake data.</p>
  </li>
  <li><p>Also suitable for image generation are <a href="http://kvfrans.com/variational-autoencoders-explained/" rel="nofollow noreferrer">Variational Autoencoders (VAEs)</a> which learn essentially by compressing a set of images down into a small representation, and as a result become able to &quot;uncompress&quot; similar representations.</p>
  </li>
  <li><p>There are also VAEGANs, which combine VAEs and GANs</p>
  </li>
  <li><p>There are other models which generate examples from a dataset. For example, Restricted Boltzmann Machines (RBMs) are similar to neural networks, but the neurons fire randomly, and RBMs require a different training process to NNs.</p>
  </li>
  <li><p>GANs, VAEs, VAEGANs, RBMs can be used to generate data in any simple non-sequential datasets, they are not restricted to just images, <a href="https://www.theverge.com/2018/12/17/18144356/ai-image-generation-fake-faces-people-nvidia-generative-adversarial-networks-gans" rel="nofollow noreferrer">but recent work with GANs for example has excelled there</a>.</p>
  </li>
  <li><p>For a different kind of generator, you can look at <a href="https://hackernoon.com/dl06-deepdream-with-code-5f735052e21f" rel="nofollow noreferrer">how Deep Dream works</a>. The interesting thing here is that it is a modification of a feed forward network that has been trained by supervised learning. Essentially to run Deep Dream, you take an existing image and change it so that it maximises some internal part(s) of the existing neural network, &quot;training&quot; the image as if it were a set of weights.</p>
  <ul>
  <li>The difference between Deep Dream and other generative techniques is that it does not generate content that could be in the training set - it is no good for creating &quot;realistic&quot; images.</li>
  </ul>
  </li>
  </ul>
  <h2>Text</h2>
  <ul>
  <li>Recurrent Neural Networks, and specifically Long Short-Term Memory (LSTM) networks can be used to model word sequences by training them to predict the next word. Because the resulting model is probabilistic (e.g. chance of next work being &quot;Hello&quot; is ~0.001%) then a simple method to make this generative is to sample from the predictions randomly, and then feeding them back into the sequence to see what it will predict next. There is <a href="http://karpathy.github.io/2015/05/21/rnn-effectiveness/" rel="nofollow noreferrer">a great blog post about this technique by Andrei Karpathy</a>.</li>
  </ul>
  <h2>Audio and Music</h2>
  <ul>
  <li><p><a href="https://deepmind.com/blog/wavenet-generative-model-raw-audio/" rel="nofollow noreferrer">DeepMind's WaveNet architecture</a> is similar to a CNN predicting the next samples of audio from a given input. It can be used in speech or music generation.</p>
  </li>
  <li><p>LSTMs are a popular choice here, as well as for language models.</p>
  </li>
  </ul>
  <p>One important caveat. Nearly all these models are hard to understand, work with and train, compared to simpler supervised techniques. Probably the easiest to get to grips with if you want to understand them well enough to implement your own versions, are Deep Dream, VAEs and LSTMs.</p>
  <p>It is also worth noting that there are many other ways to generate content than neural networks. For instance, sound and music generation has a long history completely independent of recent AI developments.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-28T15:45:55.567Z
Answers.Text: I would say that the sentence "The formal name for this difference is "generative" vs "discriminative" models." is a little misleading. Generative and discriminative models are not necessarily NNs (and given the context of the question). I would rephrase it to say that, in general, there two families of algorithms that can be used for classification: generative and discriminative models. Maybe you meant something else.
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-28T21:10:49.050Z
Answers.Text: @nbro: Except you would not use generative models for classification. I'll try to re-phrase the first sentence.
Answers.UserDisplayName: Neil Slater
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-27T18:14:34.940Z
Answers.LastActivityDate: 2019-02-27T18:32:11.667Z
Answers.LastEditDate: 2020-06-17T09:57:20.710Z
Answers.UserDisplayName: Neil Slater
Body: <p>What is the fundamental difference between NN for classifying data and generating data?</p>
  
  <p>Most examples show how neural networks can be used to classify data. Like is it an image of a dog or a cat. However, there are applications where NN are used to create images and even write short stories. </p>
  
Tags: <neural-networks>
Title: What is the fundamental difference between neural networks for classifying and generating data
UserDisplayName: Bryan McGill
ThreadText: # What is the fundamental difference between neural networks for classifying and generating data
  
  (Asked by: username_0 on 2019-02-27)
  
  What is the fundamental difference between NN for classifying data and generating data?
  
  Most examples show how neural networks can be used to classify data. Like is it an image of a dog or a cat. However, there are applications where NN are used to create images and even write short stories.
  
  **Tags:** neural-networks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-27. Score: 2 | Accepted answer
  
  The formal name for this difference is "generative" vs "discriminative" models.
  
  By default, a supervised learning process using a simple feed-forward neural network and a set of training data with expected answers will produce a discriminative model. It is hard to use such a model to generate content directly.
  
  Differences between discriminative and generative models tend to be at the architecture level or deeper, although a few generative techniques are simple variants or re-purposing of discriminative networks. There is no single "fundamental" difference in terms of NN design. About the only common theme is that generative models are more complex and harder to work with than discriminative ones.
  
  ## Images
  
  * Probably the most popular currently for image generation are [Generative Adversarial Networks or GANs](https://skymind.ai/wiki/generative-adversarial-network-gan). These train a Generator to create an image from random inputs, alongside a Discriminator that tries to spot fakes compared to real images. Training them together results in a generator network that gets progressively better at creating fake data.
  * Also suitable for image generation are [Variational Autoencoders (VAEs)](http://kvfrans.com/variational-autoencoders-explained/) which learn essentially by compressing a set of images down into a small representation, and as a result become able to "uncompress" similar representations.
  * There are also VAEGANs, which combine VAEs and GANs
  * There are other models which generate examples from a dataset. For example, Restricted Boltzmann Machines (RBMs) are similar to neural networks, but the neurons fire randomly, and RBMs require a different training process to NNs.
  * GANs, VAEs, VAEGANs, RBMs can be used to generate data in any simple non-sequential datasets, they are not restricted to just images, [but recent work with GANs for example has excelled there](https://www.theverge.com/2018/12/17/18144356/ai-image-generation-fake-faces-people-nvidia-generative-adversarial-networks-gans).
  * For a different kind of generator, you can look at [how Deep Dream works](https://hackernoon.com/dl06-deepdream-with-code-5f735052e21f). The interesting thing here is that it is a modification of a feed forward network that has been trained by supervised learning. Essentially to run Deep Dream, you take an existing image and change it so that it maximises some internal part(s) of the existing neural network, "training" the image as if it were a set of weights.
  
    + The difference between Deep Dream and other generative techniques is that it does not generate content that could be in the training set - it is no good for creating "realistic" images.
  
  ## Text
  
  * Recurrent Neural Networks, and specifically Long Short-Term Memory (LSTM) networks can be used to model word sequences by training them to predict the next word. Because the resulting model is probabilistic (e.g. chance of next work being "Hello" is ~0.001%) then a simple method to make this generative is to sample from the predictions randomly, and then feeding them back into the sequence to see what it will predict next. There is [a great blog post about this technique by Andrei Karpathy](http://karpathy.github.io/2015/05/21/rnn-effectiveness/).
  
  ## Audio and Music
  
  * [DeepMind's WaveNet architecture](https://deepmind.com/blog/wavenet-generative-model-raw-audio/) is similar to a CNN predicting the next samples of audio from a given input. It can be used in speech or music generation.
  * LSTMs are a popular choice here, as well as for language models.
  
  One important caveat. Nearly all these models are hard to understand, work with and train, compared to simpler supervised techniques. Probably the easiest to get to grips with if you want to understand them well enough to implement your own versions, are Deep Dream, VAEs and LSTMs.
  
  It is also worth noting that there are many other ways to generate content than neural networks. For instance, sound and music generation has a long history completely independent of recent AI developments.
  
  > **Comments:**
  > **username_2**: I would say that the sentence "The formal name for this difference is "generative" vs "discriminative" models." is a little misleading. Generative and discriminative models are not necessarily NNs (and given the context of the question). I would rephrase it to say that, in general, there two families of algorithms that can be used for classification: generative and discriminative models. Maybe you meant something else.  
  > **username_1**: @username_2: Except you would not use generative models for classification. I'll try to re-phrase the first sentence.  
  
  ---
  
  