title: In Keras, If samples_per_epoch is less than the 'end' of the generator when it (loops back on itself) will this negatively affect result?
body: <p>I'm using Keras with Theano to train a basic logistic regression model.</p>
  
  <p>Say I've got a training set of 1 million entries, it's too large for my system to use the standard <code>model.fit()</code> without blowing away memory.</p>
  
  <ul>
  <li>I decide to use a python generator function and fit my model using <code>model.fit_generator()</code>.  </li>
  <li>My generator function returns batch sized chunks of the 1M training examples (they come from a DB table, so I only pull enough records at a time to satisfy each batch request, keeping memory usage in check).  </li>
  <li>It's an endlessly looping generator, once it reaches the end of the 1 million, it loops and continues over the set</li>
  </ul>
  
  <p>There is a mandatory argument in <code>fit_generator()</code> to specify <code>samples_per_epoch</code>.  The documentation indicates</p>
  
  <blockquote>
    <p><strong>samples_per_epoch:</strong> integer, number of samples to process before going to the next epoch.</p>
  </blockquote>
  
  <p>I'm assuming the <code>fit_generator()</code> doesn't reset the generator each time an epoch runs, hence the need for a infinitely running generator.</p>
  
  <p>I typically set the <code>samples_per_epoch</code> to be the size of the training set the generator is looping over.</p>
  
  <p>However, if <code>samples_per_epoch</code> this is smaller than the size of the training set the generator is working from and the <code>nb_epoch</code> > 1:</p>
  
  <ul>
  <li>Will you get odd/adverse/unexpected training resulting as it seems the epochs will have differing sets training examples to fit to?</li>
  <li>If so, do you 'fastforward' you generator somehow?</li>
  </ul>