title: save model weights at the end of every N epochs
body: <p>I'm training a NN and would like to save the model weights every N epochs for a prediction phase. I propose this draft code, it's inspired by @grovina 's response <a href="https://stackoverflow.com/a/44058144/1545917">here</a>. Could you, please, make suggestions?
  Thanks in advance.</p>
  
  <pre><code>from keras.callbacks import Callback
  
  class WeightsSaver(Callback):
      def __init__(self, model, N):
          self.model = model
          self.N = N
          self.epoch = 0
  
      def on_batch_end(self, epoch, logs={}):
          if self.epoch % self.N == 0:
              name = 'weights%08d.h5' % self.epoch
              self.model.save_weights(name)
          self.epoch += 1
  </code></pre>
  
  <p>Then add it to the fit call: to save weights every 5 epochs:</p>
  
  <pre><code>model.fit(X_train, Y_train, callbacks=[WeightsSaver(model, 5)])
  </code></pre>