Answers.Body: <blockquote>
  <p>Does the ANN's training data include the proper output for every neuron?</p>
  </blockquote>
  <p>The <strong>short answer</strong> is: <strong>no</strong> (not usually or directly).</p>
  <p>The <strong>long answer</strong> is that you can train neural networks in <strong>different ways</strong>. There's <strong>supervised</strong>, <strong>unsupervised</strong>, <strong>reinforcement learning/training</strong>, or even other ways (e.g. online learning).</p>
  <p>The most common way of training neural networks is probably in a <strong>supervised</strong> (and <strong>offline</strong>) <strong>way</strong>. In this case, you typically have a dataset of input-output pairs of the form <span class="math-container">$D = \{(x_1, y_1), \dots, (x_N, y_N) \}$</span>, where we assume that there's an <strong>unknown function</strong> <span class="math-container">$f$</span> such that <span class="math-container">$f(x_i) = y_i$</span>, so <span class="math-container">$x_i$</span> and <span class="math-container">$y_i$</span> are the input and corresponding output of <span class="math-container">$f$</span>. In this case, we want our neural network, which we can denote by <span class="math-container">$g_{\theta}$</span> (where <span class="math-container">$\theta$</span> are its weights/parameters), to <em>approximate</em> <span class="math-container">$f$</span>, i.e. <span class="math-container">$g_\theta \approx f$</span>, for every input and output of <span class="math-container">$f$</span>. Unfortunately, <span class="math-container">$D$</span> does not usually contain all input-output pairs of <span class="math-container">$f$</span> (if we had access to all input-output pairs, we wouldn't even need machine learning), so that's why we can only <em>approximate</em> <span class="math-container">$f$</span> with our neural network <span class="math-container">$g_\theta$</span> (there's also the aspect that <span class="math-container">$D$</span> could be <em>noisy</em>, but you can ignore this for now).</p>
  <p>So, in this supervised learning context, <span class="math-container">$y_i$</span> (also known as the <strong>labels</strong> or <strong>targets</strong>) are the <strong>supervisory signals</strong> to teach the neural network what it's supposed to produce for <span class="math-container">$x_i$</span>. So, let's say the neural network produces <span class="math-container">$\hat{y}_i$</span> rather than <span class="math-container">$y_i$</span> when given <span class="math-container">$x_i$</span>, i.e. <span class="math-container">$g_\theta(x_i) = \hat{y}_i$</span>. In that case, we have an &quot;error&quot; of <span class="math-container">$\hat{y}_i - y_i$</span>, but you could also compute the error in other forms other than the difference (depending on the nature of the targets/labels), for example,<span class="math-container">$|\hat{y}_i - y_i |$</span> or <span class="math-container">$(\hat{y}_i - y_i)^2$</span>.</p>
  <p>So, once we know the error, we should change the weights of the neural network, i.e. <span class="math-container">$\theta$</span>, so that the error is smaller the next time we feed <span class="math-container">$x_i$</span> as input to <span class="math-container">$g_\theta$</span>. The way we usually do that is with <strong>back-propagation</strong>.</p>
  <p>You can only understand back-propagation if you understand <strong>derivatives</strong> and, in particular, how to take derivatives of functions with respect to multiple parameters. Essentially, back-propagation is really just an automatic way of computing derivatives. So, to understand it, you will first need to study a little bit of calculus. This answer is already quite long, so I will not provide more details here, but there are many videos online that explain (even just intuitively) how back-propagation works. So, you should watch them. If you're already familiar with derivatives, maybe <a href="http://neuralnetworksanddeeplearning.com/chap2.html" rel="nofollow noreferrer">this article</a> may be useful (I read it when I was first learning about the topic, but I had already a good knowledge of basic calculus before doing that).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-06T12:43:36.843Z
Answers.LastActivityDate: 2021-10-06T12:43:36.843Z
Answers.UserDisplayName: nbro
Body: <p>I was designing an Artificial Neural Network a while back, but hit a bump when I got to the backpropagation. I was having trouble making the script choose whether to add or subtract from the weights, when I had a thought.</p>
  <p>Does the ANN's training data include the proper output of all the neurons, or just the input and output layers? If it's the latter, could somebody please explain how backpropagation works in a simple way?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-05T13:05:23.283Z
Comments.Text: watch the 3blue1brown vids on [what is neural net](https://www.youtube.com/watch?v=aircAruvnKk&ab_channel=3Blue1Brown), personally it as simple and as intuitive as it can be.
Comments.UserDisplayName: Sanyou
Tags: <neural-networks><training><backpropagation><training-datasets>
Title: Does the ANN's training data include the proper output for every neuron?
UserDisplayName: Blue Herring
ThreadText: # Does the ANN's training data include the proper output for every neuron?
  
  (Asked by: username_0 on 2021-10-05)
  
  I was designing an Artificial Neural Network a while back, but hit a bump when I got to the backpropagation. I was having trouble making the script choose whether to add or subtract from the weights, when I had a thought.
  
  Does the ANN's training data include the proper output of all the neurons, or just the input and output layers? If it's the latter, could somebody please explain how backpropagation works in a simple way?
  
  **Tags:** neural-networks, training, backpropagation, training-datasets
  > **Comments:**
  > **username_1**: watch the 3blue1brown vids on [what is neural net](https://www.youtube.com/watch?v=aircAruvnKk&ab_channel=3Blue1Brown), personally it as simple and as intuitive as it can be.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-10-06. Score: 2 | Accepted answer
  
  > Does the ANN's training data include the proper output for every neuron?
  
  The **short answer** is: **no** (not usually or directly).
  
  The **long answer** is that you can train neural networks in **different ways**. There's **supervised**, **unsupervised**, **reinforcement learning/training**, or even other ways (e.g. online learning).
  
  The most common way of training neural networks is probably in a **supervised** (and **offline**) **way**. In this case, you typically have a dataset of input-output pairs of the form $D = \{(x\_1, y\_1), \dots, (x\_N, y\_N) \}$, where we assume that there's an **unknown function** $f$ such that $f(x\_i) = y\_i$, so $x\_i$ and $y\_i$ are the input and corresponding output of $f$. In this case, we want our neural network, which we can denote by $g\_{\theta}$ (where $\theta$ are its weights/parameters), to *approximate* $f$, i.e. $g\_\theta \approx f$, for every input and output of $f$. Unfortunately, $D$ does not usually contain all input-output pairs of $f$ (if we had access to all input-output pairs, we wouldn't even need machine learning), so that's why we can only *approximate* $f$ with our neural network $g\_\theta$ (there's also the aspect that $D$ could be *noisy*, but you can ignore this for now).
  
  So, in this supervised learning context, $y\_i$ (also known as the **labels** or **targets**) are the **supervisory signals** to teach the neural network what it's supposed to produce for $x\_i$. So, let's say the neural network produces $\hat{y}\_i$ rather than $y\_i$ when given $x\_i$, i.e. $g\_\theta(x\_i) = \hat{y}\_i$. In that case, we have an "error" of $\hat{y}\_i - y\_i$, but you could also compute the error in other forms other than the difference (depending on the nature of the targets/labels), for example,$|\hat{y}\_i - y\_i |$ or $(\hat{y}\_i - y\_i)^2$.
  
  So, once we know the error, we should change the weights of the neural network, i.e. $\theta$, so that the error is smaller the next time we feed $x\_i$ as input to $g\_\theta$. The way we usually do that is with **back-propagation**.
  
  You can only understand back-propagation if you understand **derivatives** and, in particular, how to take derivatives of functions with respect to multiple parameters. Essentially, back-propagation is really just an automatic way of computing derivatives. So, to understand it, you will first need to study a little bit of calculus. This answer is already quite long, so I will not provide more details here, but there are many videos online that explain (even just intuitively) how back-propagation works. So, you should watch them. If you're already familiar with derivatives, maybe [this article](http://neuralnetworksanddeeplearning.com/chap2.html) may be useful (I read it when I was first learning about the topic, but I had already a good knowledge of basic calculus before doing that).
  
  
  ---
  
  