Answers.Body: <p>The output depends on what answer you want from the network. Think of the network as a function <span class="math-container">$f$</span> with weights <span class="math-container">$\theta$</span>, that takes an input <span class="math-container">$x$</span> and gives some output <span class="math-container">$y$</span>:</p>
  <p><span class="math-container">$$
  f_\theta(X) \rightarrow y
  $$</span></p>
  <p>The example you give (dog=1 or cat=0) is <a href="https://en.wikipedia.org/wiki/Binary_classification" rel="nofollow noreferrer">binary classification</a> -- the answer from the network is &quot;this looks more like a dog than a cat&quot; if the output <span class="math-container">$y &gt; 0.5$</span> or vice versa. So yes, <span class="math-container">$y$</span> is a scalar between 0 and 1.</p>
  <p>If you had three or more classes e.g [dog, cat, banana] (<a href="https://en.wikipedia.org/wiki/Multiclass_classification" rel="nofollow noreferrer">multimomial classification</a>), you want the network to answer how &quot;confident&quot; it is that the <span class="math-container">$x$</span> is a certain class. It will give a prediction for each class. In this example <span class="math-container">$y$</span> will be a vector of size 3, each element being a prediction for a class e.g y = <span class="math-container">$[dog=0.3, cat=0.01, banana=0.7]$</span></p>
  <p>For a non-classification example: say a robot's action comprises the velocity  <span class="math-container">$v$</span> and a joint angle <span class="math-container">$\phi$</span> (action = <span class="math-container">$[v, \phi]$</span>). The robot's questions a neural network with &quot;what action should I take?&quot;. The network's answer <span class="math-container">$y$</span>  might looks like <span class="math-container">$ y = [v=3.0, \phi=23]$</span>. So the size of the output will be dependant on the dimensions of the action. In this case we have a multiple-dimension output, one dimension for velocity, and one for the joint angle.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-26T06:25:21.163Z
Answers.LastActivityDate: 2021-06-26T06:25:21.163Z
Answers.UserDisplayName: mugoh
Body: <p>What I understand is, each input in a neural network is a feature.</p>
  <p>However, what I don't understand is, when we need multiple outputs in a neural network.</p>
  <p>For example, say, if we are classifying cats and dogs, only one output is enough. 0 = cat, 1 = dog.</p>
  <p>When does a neural network have a single and when does it have multiple outputs?</p>
  
Tags: <neural-networks>
Title: When does a neural network have a single and when does it have multiple outputs?
UserDisplayName: user366312
ThreadText: # When does a neural network have a single and when does it have multiple outputs?
  
  (Asked by: username_0 on 2021-06-25)
  
  What I understand is, each input in a neural network is a feature.
  
  However, what I don't understand is, when we need multiple outputs in a neural network.
  
  For example, say, if we are classifying cats and dogs, only one output is enough. 0 = cat, 1 = dog.
  
  When does a neural network have a single and when does it have multiple outputs?
  
  **Tags:** neural-networks
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-06-26. Score: 4 | Accepted answer
  
  The output depends on what answer you want from the network. Think of the network as a function $f$ with weights $\theta$, that takes an input $x$ and gives some output $y$:
  
  $$
  f\_\theta(X) \rightarrow y
  $$
  
  The example you give (dog=1 or cat=0) is [binary classification](https://en.wikipedia.org/wiki/Binary_classification) -- the answer from the network is "this looks more like a dog than a cat" if the output $y > 0.5$ or vice versa. So yes, $y$ is a scalar between 0 and 1.
  
  If you had three or more classes e.g [dog, cat, banana] ([multimomial classification](https://en.wikipedia.org/wiki/Multiclass_classification)), you want the network to answer how "confident" it is that the $x$ is a certain class. It will give a prediction for each class. In this example $y$ will be a vector of size 3, each element being a prediction for a class e.g y = $[dog=0.3, cat=0.01, banana=0.7]$
  
  For a non-classification example: say a robot's action comprises the velocity $v$ and a joint angle $\phi$ (action = $[v, \phi]$). The robot's questions a neural network with "what action should I take?". The network's answer $y$ might looks like $ y = [v=3.0, \phi=23]$. So the size of the output will be dependant on the dimensions of the action. In this case we have a multiple-dimension output, one dimension for velocity, and one for the joint angle.
  
  
  ---
  
  