'Called when an epoch is about to end
Arguments:
callback_data (HDF5 dataset): shared data between callbacks
model (Model): model object
epoch (int): index of epoch that is ending'

def on_epoch_end(self, callback_data, model, epoch):

    _eil = self._get_cached_epoch_loss(callback_data, model, epoch, 'loss')
    if _eil:
        (self.stop_state, finished) = self.stop_func(self.stop_state, _eil['cost'])
        if finished:
            model.finished = True
            logger.warn(('Early    stopping    function    triggered:    mean_cost    %f.' % _eil['cost']))
