title: Is there an alternative to fit_generator() without having to set samples_per_epoch?
body: <p>I do not understand the design of the <code>fit_generator()</code> method. In my example the number of samples may vary and I am not able to determine the number of samples beforehand unless going through the whole data set beforehand.</p>
  
  <pre class="lang-py prettyprint-override"><code>model.fit_generator(generator=batch_generator(train_data),
                              samples_per_epoch=10000,
                              nb_epoch=1,
                              nb_worker=1)
  </code></pre>
  
  <p>In my scenario I have recorded laps. Since those laps are not finished equally fast, the number of <em>samples</em> in each lap may vary.</p>
  
  <p>Imho it would be nice if I could simply throw a <code>StopIteration</code> exception to indicate the end of an epoch. Even better would be a <code>EpochEnd</code> and a <code>TrainingEnd</code> exception to control epochs and the whole training based on these exception but I guess that's not possible.</p>
  
  <p>However, I'd like to know if I can use something like <code>fit_generator()</code> without having to know the number of samples of each epoch.</p>