(self, callback_data, model, epoch)
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
Called when an epoch is about to end
Called when an epoch is about to end
def on_epoch_end(self, callback_data, model, epoch):
        """
        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
        """
        if (epoch + 1) % self.epoch_freq == 0:
            self.eval_set.reset()

            running_stats = np.zeros_like(self.metric.outputs.get(), dtype=np.float32)

            # Calculate the metric values
            nbatch = 0
            for x, t in self.eval_set:
                x = model.fprop(x, inference=True)

                self.metric(x, t)
                running_stats += self.metric.outputs.get()
                nbatch += 1

            running_stats /= nbatch

            # Print the statistics for all the labels
            for i, label in enumerate(self.labels):
                metric_text = "["
                for k, metric in enumerate(self.metric.metric_names):
                    metric_text += "%s: %d%% " % (metric, running_stats[i][k] * 100.0)

                metric_text += "] -> %s\n" % label
                sys.stdout.write(metric_text)
                sys.stdout.flush()
def on_epoch_end ( self , callback_data , model , epoch ) : if ( epoch + 1 ) % self . epoch_freq == 0 : self . eval_set . reset ( ) running_stats = np . zeros_like ( self . metric . outputs . get ( ) , dtype = np . float32 ) # Calculate the metric values nbatch = 0 for x , t in self . eval_set : x = model . fprop ( x , inference = True ) self . metric ( x , t ) running_stats += self . metric . outputs . get ( ) nbatch += 1 running_stats /= nbatch # Print the statistics for all the labels for i , label in enumerate ( self . labels ) : metric_text = "[" for k , metric in enumerate ( self . metric . metric_names ) : metric_text += "%s: %d%% " % ( metric , running_stats [ i ] [ k ] * 100.0 ) metric_text += "] -> %s\n" % label sys . stdout . write ( metric_text ) sys . stdout . flush ( )