Answers.Body: <p>Your network must have something which persist like <strong>weights</strong> add <strong>bias</strong></p>
  
  <p>Your new implementation would be like this : </p>
  
  <pre><code>trainingData = [{in: [0,0], out:[0]}, {in: [0,1], out:[0]}, ...];
  iterations = 10000
  
  network = graphNodesToNetwork()
  links = graphLinksToNetwork()
  randomiseLinkWeights(links)
  weights = []
  
  
  while(trainingData not empty) {
      for(0&lt;iterations) { 
         set = trainingData.pop()
  
         weights = updateInput(network, set.in)
  
         forwardPropagate(network, links) 
  
         linkUpdate = backPropagate(network, links, set.out, weights)
  
         updateLinks(linkUpdate, links)}
  }
  </code></pre>
  
  <p>Inshort retain <strong>weights</strong>, and backprapogate.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-16T06:50:50.763Z
Answers.LastActivityDate: 2018-08-16T06:50:50.763Z
Answers.UserDisplayName: Patel Sunil
Answers.Body: <p>It looks like you are training you model 10,000 times on one piece of data, and then dropping that piece and moving to the next.</p>
  
  <p>This will not work: the model will become extremely good at learning one piece of data, but will then forget about it when optimizing for the next piece.</p>
  
  <p>Instead, either pick one example at random in each iteration, or compute the gradient for all 4 examples and just update in that direction instead.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-15T22:50:25.250Z
Answers.LastActivityDate: 2018-08-15T22:50:25.250Z
Answers.UserDisplayName: John Doucette
Body: <p>I thought I have implemented the code (from scratch, no library) for an <strong>artificial neural network</strong> (first endeavour in the field). But I feel like I miss something very basic or obvious. </p>
  
  <p>To make it short: code works for a single pair of in-/out-values but fails for sets of value pairs. I do not really understand the training process. So I want to get this issue out of the way first. The following is my improvised training (aka all that I can think of) in pseudocode.</p>
  
  <pre><code>trainingData = [{in: [0,0], out:[0]}, {in: [0,1], out:[0]}, ...];
  iterations = 10000
  
  network = graphNodesToNetwork()
  links = graphLinksToNetwork()
  randomiseLinkWeights(links)
  
  
  while(trainingData not empty) {
    for(0&lt;iterations) { 
       set = trainingData.pop()
  
       updateInput(network, set.in)
  
       forwardPropagate(network, links) 
  
       linkUpdate = backPropagate(network, links, set.out)
  
       updateLinks(linkUpdate, links)}
  }
  </code></pre>
  
  <p>Is this how it is supposed to work? Do you feed in your training data set by set (while-loop)? </p>
  
  <p><em>Edit 1: because my final comment did distract from the issue at hand.</em></p>
  
  <p><em>Edit 2: less wordy, more code-y</em></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-22T08:25:00.257Z
Comments.Text: Removed my comment for clarity.
Comments.UserDisplayName: Col. Cool
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-22T11:25:54.563Z
Comments.Text: Do you mean in terms of what I have set up so far or do you mean in terms of describing my problem? I am afraid you mean the latter which could be an issue. Would pseudo code be acceptable? Hold on... Edited question.
Comments.UserDisplayName: Col. Cool
Tags: <neural-networks><training>
Title: How to actually teach the ANN the resulting weights of different training inputs?
UserDisplayName: Col. Cool
ThreadText: # How to actually teach the ANN the resulting weights of different training inputs?
  
  (Asked by: username_0 on 2018-06-22)
  
  I thought I have implemented the code (from scratch, no library) for an **artificial neural network** (first endeavour in the field). But I feel like I miss something very basic or obvious.
  
  To make it short: code works for a single pair of in-/out-values but fails for sets of value pairs. I do not really understand the training process. So I want to get this issue out of the way first. The following is my improvised training (aka all that I can think of) in pseudocode.
  
  ```
  trainingData = [{in: [0,0], out:[0]}, {in: [0,1], out:[0]}, ...];
  iterations = 10000
  
  network = graphNodesToNetwork()
  links = graphLinksToNetwork()
  randomiseLinkWeights(links)
  
  while(trainingData not empty) {
    for(0<iterations) { 
       set = trainingData.pop()
  
       updateInput(network, set.in)
  
       forwardPropagate(network, links) 
  
       linkUpdate = backPropagate(network, links, set.out)
  
       updateLinks(linkUpdate, links)}
  }
  
  ```
  
  Is this how it is supposed to work? Do you feed in your training data set by set (while-loop)?
  
  *Edit 1: because my final comment did distract from the issue at hand.*
  
  *Edit 2: less wordy, more code-y*
  
  **Tags:** neural-networks, training
  
  > **Comments:**
  > **username_0**: Removed my comment for clarity.  
  > **username_0**: Do you mean in terms of what I have set up so far or do you mean in terms of describing my problem? I am afraid you mean the latter which could be an issue. Would pseudo code be acceptable? Hold on... Edited question.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-08-16. Score: 2
  
  Your network must have something which persist like **weights** add **bias**
  
  Your new implementation would be like this :
  
  ```
  trainingData = [{in: [0,0], out:[0]}, {in: [0,1], out:[0]}, ...];
  iterations = 10000
  
  network = graphNodesToNetwork()
  links = graphLinksToNetwork()
  randomiseLinkWeights(links)
  weights = []
  
  while(trainingData not empty) {
      for(0<iterations) { 
         set = trainingData.pop()
  
         weights = updateInput(network, set.in)
  
         forwardPropagate(network, links) 
  
         linkUpdate = backPropagate(network, links, set.out, weights)
  
         updateLinks(linkUpdate, links)}
  }
  
  ```
  
  Inshort retain **weights**, and backprapogate.
  
  
  ---
  
  ### Answer by username_2 on 2018-08-15. Score: 1
  
  It looks like you are training you model 10,000 times on one piece of data, and then dropping that piece and moving to the next.
  
  This will not work: the model will become extremely good at learning one piece of data, but will then forget about it when optimizing for the next piece.
  
  Instead, either pick one example at random in each iteration, or compute the gradient for all 4 examples and just update in that direction instead.
  
  
  ---
  
  