Answers.Body: <p>Assume the image can contain objects of class <span class="math-container">$C_1 \dots C_c$</span>. Assume a set of additional inputs that has a meaning of questions as &quot;contains the image a C_i or C_j or ... ?&quot;.</p>
  <p>The main problem for the system is classify the image in classes <span class="math-container">$C_i$</span>. Second problem is answer the implicit question proposed by the remainder inputs.</p>
  <p>Thus, better combine two NNs:</p>
  <ul>
  <li>first one an object recognizer, with input the image data.</li>
  <li>second one a NN that will answer the question implicit in remainder bits, with inputs the output of previous NN and the &quot;question&quot; bits.</li>
  </ul>
  <p>In concrete for the example that the question describe:</p>
  <ul>
  <li>a NN to classify dog/cat from 32x32 image. Two outputs for probabilities of dog an cat. Or simply one binary output 0:&quot;is a dog&quot;, 1:&quot;is a cat&quot;.</li>
  <li>a second NN with the &quot;1025&quot; binary input ( 0: &quot;look for dogs&quot;, 1: &quot;look for cats&quot;) and output from previous one. In this case, if everything is ok, it will infer the logic &quot;a==b&quot;: &quot;is a dog&quot; and &quot;look for dogs&quot; or &quot;is a cat&quot; and &quot;look for cats&quot;.</li>
  </ul>
  <p>Note that if you try to solve the problem directly with a full-connected NN with all inputs (1025 in the example), you loss the possibility of use CNN and max-pooling layers, etc. Moreover, split decreases training times, join subjects increases them &quot;exponentially&quot;. Not a promising way.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-21T16:00:08.733Z
Answers.LastActivityDate: 2020-10-21T16:06:00.370Z
Answers.LastEditDate: 2020-10-21T16:06:00.370Z
Answers.UserDisplayName: pasaba por aqui
Answers.Body: <p>The main benefit of deep learning is that you don't have to manually design features.</p>
  <p>Classic Machine Learning algorithms always include the <a href="https://en.wikipedia.org/wiki/Feature_engineering" rel="nofollow noreferrer">Feature engineering</a> step, whereas neural networks are able to extract features automatically during learning. The classic example is CNN. In the first layer, it creates simple features that representing lines, the last layers represent abstract features. Of course, some tasks do require feature engineering (e.g. signal processing).</p>
  <p>In your case, if you want to take advantage of the CNN network, you can also add an additional input layer for the flag (e.g. as one-hot vector). Here is an illustration taken from this <a href="https://stackoverflow.com/questions/53516662/two-inputs-to-one-model-in-keras">answer</a>.</p>
  <p><a href="https://i.sstatic.net/cSC40m.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cSC40m.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-21T18:06:03.623Z
Answers.Text: Your comments and answer seems a few contradictory. First you propose handle in same way all 1025 inputs, next you talk about a CNN (with 32*32+1 inputs ?) and finally propose an architecture with two separated stages.
Answers.UserDisplayName: pasaba por aqui
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-21T18:14:12.923Z
Answers.Text: there are different approaches. I assume, the authors feeds an image as a NxM vector, as he mentioned that he has `1025-th element`. So it is possible to add one extra feature. I have also added some additional information on CCN for generalization
Answers.UserDisplayName: Aray Karjauv
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-21T21:28:59.177Z
Answers.Text: Are neural nets *in general* able to crate features automatically during learning, or this is a *specific* characteristic of CNNs?
Answers.UserDisplayName: desertnaut
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-21T22:17:20.233Z
Answers.Text: This applies not only to CNN. As I wrote, CNN is just a classic example.
Answers.UserDisplayName: Aray Karjauv
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-21T16:34:50.340Z
Answers.LastActivityDate: 2021-06-26T23:04:17.783Z
Answers.LastEditDate: 2021-06-26T23:04:17.783Z
Answers.UserDisplayName: Aray Karjauv
Body: <p>Assume that I have a fully connected network that takes in a vector containing <code>1025</code> elements. First <code>1024</code> elements are related to the input image of size <code>32 x 32 x 1</code>, and the last element in the vector (<code>1025-th element</code>) is a control bit that I call it <em>special input</em>.</p>
  <p>When this bit is <code>zero</code>, the network should predict if there is a <code>cat</code> in the image or not, and when this bit is <code>one</code>, it should predict if there is a <code>dog</code> in the image or not.</p>
  <p>So how can I tell the network that your <code>1025-th element</code> should be special to you and you should pay more attention to it?</p>
  <p>Note that it's just an example and the real problem is more complex than this. So please don't bypass the goal of this question by using tricks special to this example. Any idea is appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-21T14:28:25.997Z
Comments.Text: The main benefit of deep learning is that you don't have to manually design your features. The network itself will map it. So, I suppose you can just train your algorithm with your dataset.
Comments.UserDisplayName: Aray Karjauv
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-21T14:46:04.667Z
Comments.Text: Thank you for commenting. My hope of this happening was so low that I did not even bother myself to test a simple scenario like this. But as you say it will happen, I will test it soon and return the result here.
Comments.UserDisplayName: amin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-21T15:58:34.140Z
Comments.Text: @ArayKarjauv Yes it worked. If you want, you can write your comment as answer and I will accept it
Comments.UserDisplayName: amin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-21T16:53:15.667Z
Comments.Text: by the way, you can also add one more input layer for your flag. I updated my answer.
Comments.UserDisplayName: Aray Karjauv
Tags: <deep-learning><tensorflow><keras><feedforward-neural-networks>
Title: How to tell a neural network that: "your i-th input is special"
UserDisplayName: amin
ThreadText: # How to tell a neural network that: "your i-th input is special"
  
  (Asked by: username_0 on 2020-10-21)
  
  Assume that I have a fully connected network that takes in a vector containing `1025` elements. First `1024` elements are related to the input image of size `32 x 32 x 1`, and the last element in the vector (`1025-th element`) is a control bit that I call it *special input*.
  
  When this bit is `zero`, the network should predict if there is a `cat` in the image or not, and when this bit is `one`, it should predict if there is a `dog` in the image or not.
  
  So how can I tell the network that your `1025-th element` should be special to you and you should pay more attention to it?
  
  Note that it's just an example and the real problem is more complex than this. So please don't bypass the goal of this question by using tricks special to this example. Any idea is appreciated.
  
  **Tags:** deep-learning, tensorflow, keras, feedforward-neural-networks
  > **Comments:**
  > **username_1**: The main benefit of deep learning is that you don't have to manually design your features. The network itself will map it. So, I suppose you can just train your algorithm with your dataset.  
  > **username_0**: Thank you for commenting. My hope of this happening was so low that I did not even bother myself to test a simple scenario like this. But as you say it will happen, I will test it soon and return the result here.  
  > **username_0**: @ArayKarjauv Yes it worked. If you want, you can write your comment as answer and I will accept it  
  > **username_1**: by the way, you can also add one more input layer for your flag. I updated my answer.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-10-21. Score: 2 | Accepted answer
  
  The main benefit of deep learning is that you don't have to manually design features.
  
  Classic Machine Learning algorithms always include the [Feature engineering](https://en.wikipedia.org/wiki/Feature_engineering) step, whereas neural networks are able to extract features automatically during learning. The classic example is CNN. In the first layer, it creates simple features that representing lines, the last layers represent abstract features. Of course, some tasks do require feature engineering (e.g. signal processing).
  
  In your case, if you want to take advantage of the CNN network, you can also add an additional input layer for the flag (e.g. as one-hot vector). Here is an illustration taken from this [answer](https://stackoverflow.com/questions/53516662/two-inputs-to-one-model-in-keras).
  
  [![enter image description here](https://i.sstatic.net/cSC40m.png)](https://i.sstatic.net/cSC40m.png)
  
  > **Comments:**
  > **username_2**: Your comments and answer seems a few contradictory. First you propose handle in same way all 1025 inputs, next you talk about a CNN (with 32*32+1 inputs ?) and finally propose an architecture with two separated stages.  
  > **username_1**: there are different approaches. I assume, the authors feeds an image as a NxM vector, as he mentioned that he has `1025-th element`. So it is possible to add one extra feature. I have also added some additional information on CCN for generalization  
  > **username_3**: Are neural nets *in general* able to crate features automatically during learning, or this is a *specific* characteristic of CNNs?  
  > **username_1**: This applies not only to CNN. As I wrote, CNN is just a classic example.  
  
  ---
  
  ### Answer by username_2 on 2020-10-21. Score: 2
  
  Assume the image can contain objects of class $C\_1 \dots C\_c$. Assume a set of additional inputs that has a meaning of questions as "contains the image a C\_i or C\_j or ... ?".
  
  The main problem for the system is classify the image in classes $C\_i$. Second problem is answer the implicit question proposed by the remainder inputs.
  
  Thus, better combine two NNs:
  
  * first one an object recognizer, with input the image data.
  * second one a NN that will answer the question implicit in remainder bits, with inputs the output of previous NN and the "question" bits.
  
  In concrete for the example that the question describe:
  
  * a NN to classify dog/cat from 32x32 image. Two outputs for probabilities of dog an cat. Or simply one binary output 0:"is a dog", 1:"is a cat".
  * a second NN with the "1025" binary input ( 0: "look for dogs", 1: "look for cats") and output from previous one. In this case, if everything is ok, it will infer the logic "a==b": "is a dog" and "look for dogs" or "is a cat" and "look for cats".
  
  Note that if you try to solve the problem directly with a full-connected NN with all inputs (1025 in the example), you loss the possibility of use CNN and max-pooling layers, etc. Moreover, split decreases training times, join subjects increases them "exponentially". Not a promising way.
  
  
  ---
  
  