Answers.Body: <blockquote>
    <ol>
    <li><p>Run the algorithm on a chunk of the data for a large number of iterations and then do the same with another chunk and so on?</p>
    
    <p>(Such approach will not produce the same result as mini-batch gradient descent, as I am not including all data in one iteration, but rather learning from some data and then proceeding to learn on more data, beginning with the updated weights may still converge to a reasonably trained network.)</p></li>
    </ol>
  </blockquote>
  
  <p>This might work if each of the chunks of data individually is still large enough and sufficiently representative of the distribution of the complete population, but probably not the best way to go. In fact, I don't expect it to perform much better than simply using only the very last chunk, and training only on that one. This is because of the following reason. Suppose you first train for a while on chunk A, then for a long time on chunk B, then for a long time on chunk C, etc. While learning on chunk B, there is a significant risk that your model will "forget" everything it learned from chunk A. When learning on chunk C afterwards, it can also "forget" everything learned from chunk B again.</p>
  
  <p>In pseudocode, the approach you proposed here looks as follows:</p>
  
  <pre><code>for each chunk:
      for large number of iterations:
          learn on chunk()
  </code></pre>
  
  <p>An easy way to improve on that would be to swap the loops around:</p>
  
  <pre><code>for large number of iterations:
      for each chunk:
          learn on chunk()
  </code></pre>
  
  <p>What I just described there is actually how I interpret "mini-batch gradient descent" though, the chunks would be minibatches (and the minibatches / chunks would be randomly re-selected from the complete population in every iteration of the outer loop, you wouldn't always use the same chunks). <strong>Note that this wouldn't be effective if your dataset is so large that it doesn't fit inside your RAM all at the same time</strong>, because then you'll have to deal with excessive I/O.</p>
  
  <hr>
  
  <blockquote>
    <ol start="2">
    <li>Run the same algorithm (the same model also with only data varying) on different PC's (each PC using a chunk of the data) and then see the performance on a test set and take the final decision as a weighted average of all the different models' outputs with the weight being high for the model which did the best on test sets?</li>
    </ol>
  </blockquote>
  
  <p>Yes, this can definitely be effective. This kind of idea (training different models on different subsets of data) is generally referred to as "ensemble" methods. You can even vary the models you use (e.g., have an ensemble with some Random Forests, some SVMs, some Neural Networks, etc.).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-27T19:45:16.527Z
Answers.LastActivityDate: 2020-05-23T13:47:46.853Z
Answers.LastEditDate: 2020-05-23T13:47:46.853Z
Answers.UserDisplayName: Dennis Soemers
Body: <p>If one has a dataset large enough to learn a highly complex function, say learning chess game-play, and the processing time to run mini-batch gradient descent on this entire dataset is too high, can I instead do the following?</p>
  <ol>
  <li><p>Run the algorithm on a chunk of the data for a large number of iterations and then do the same with another chunk and so on?</p>
  <p>(Such approach will not produce the same result as mini-batch gradient descent, as I am not including all data in one iteration, but rather learning from some data and then proceeding to learn on more data, beginning with the updated weights may still converge to a reasonably trained network.)</p>
  </li>
  <li><p>Run the same algorithm (the same model also with only data varying) on different PC's (each PC using a chunk of the data) and then see the performance on a test set and take the final decision as a weighted average of all the different models' outputs with the weight being high for the model which did the best on test sets?</p>
  </li>
  </ol>
  
Tags: <neural-networks><training><datasets><gradient-descent>
Title: For each epoch, can I use only on a subset of the full training dataset to train the neural network?
UserDisplayName: pranav
ThreadText: # For each epoch, can I use only on a subset of the full training dataset to train the neural network?
  
  (Asked by: username_0 on 2018-07-27)
  
  If one has a dataset large enough to learn a highly complex function, say learning chess game-play, and the processing time to run mini-batch gradient descent on this entire dataset is too high, can I instead do the following?
  
  1. Run the algorithm on a chunk of the data for a large number of iterations and then do the same with another chunk and so on?
  
     (Such approach will not produce the same result as mini-batch gradient descent, as I am not including all data in one iteration, but rather learning from some data and then proceeding to learn on more data, beginning with the updated weights may still converge to a reasonably trained network.)
  2. Run the same algorithm (the same model also with only data varying) on different PC's (each PC using a chunk of the data) and then see the performance on a test set and take the final decision as a weighted average of all the different models' outputs with the weight being high for the model which did the best on test sets?
  
  **Tags:** neural-networks, training, datasets, gradient-descent
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-07-27. Score: 3
  
  > 1. Run the algorithm on a chunk of the data for a large number of iterations and then do the same with another chunk and so on?
  >
  >    (Such approach will not produce the same result as mini-batch gradient descent, as I am not including all data in one iteration, but rather learning from some data and then proceeding to learn on more data, beginning with the updated weights may still converge to a reasonably trained network.)
  
  This might work if each of the chunks of data individually is still large enough and sufficiently representative of the distribution of the complete population, but probably not the best way to go. In fact, I don't expect it to perform much better than simply using only the very last chunk, and training only on that one. This is because of the following reason. Suppose you first train for a while on chunk A, then for a long time on chunk B, then for a long time on chunk C, etc. While learning on chunk B, there is a significant risk that your model will "forget" everything it learned from chunk A. When learning on chunk C afterwards, it can also "forget" everything learned from chunk B again.
  
  In pseudocode, the approach you proposed here looks as follows:
  
  ```
  for each chunk:
      for large number of iterations:
          learn on chunk()
  
  ```
  
  An easy way to improve on that would be to swap the loops around:
  
  ```
  for large number of iterations:
      for each chunk:
          learn on chunk()
  
  ```
  
  What I just described there is actually how I interpret "mini-batch gradient descent" though, the chunks would be minibatches (and the minibatches / chunks would be randomly re-selected from the complete population in every iteration of the outer loop, you wouldn't always use the same chunks). **Note that this wouldn't be effective if your dataset is so large that it doesn't fit inside your RAM all at the same time**, because then you'll have to deal with excessive I/O.
  
  ---
  
  > 2. Run the same algorithm (the same model also with only data varying) on different PC's (each PC using a chunk of the data) and then see the performance on a test set and take the final decision as a weighted average of all the different models' outputs with the weight being high for the model which did the best on test sets?
  
  Yes, this can definitely be effective. This kind of idea (training different models on different subsets of data) is generally referred to as "ensemble" methods. You can even vary the models you use (e.g., have an ensemble with some Random Forests, some SVMs, some Neural Networks, etc.).
  
  
  ---
  
  