(self, metadata)
Log images, metrics and hyperparamters.
Log images, metrics and hyperparamters.
Log images metrics and hyperparamters .
def on_epoch_end(self, metadata):
        """Log images, metrics and hyperparamters."""
        epoch = metadata.get('epoch')

        # create weight image
        master_df = pd.concat(self.weights).sort_index()
        self.writer.add_image('weights', master_df.values[np.newaxis, ...], global_step=metadata['epoch'])
        self.weights = []

        # log scalars
        try:
            df = self.run.history.metrics_per_epoch(epoch)

            metrics = {'/'.join(list(map(lambda x: str(x), k))): v for k, v in
                       df.groupby(['dataloader', 'metric', 'lookback'])['value'].mean().items()}

            for metric_name, metric_value in metrics.items():
                self.writer.add_scalar(metric_name, metric_value, global_step=epoch)

        except KeyError:
            pass
def on_epoch_end ( self , metadata ) : epoch = metadata . get ( 'epoch' ) # create weight image master_df = pd . concat ( self . weights ) . sort_index ( ) self . writer . add_image ( 'weights' , master_df . values [ np . newaxis , ... ] , global_step = metadata [ 'epoch' ] ) self . weights = [ ] # log scalars try : df = self . run . history . metrics_per_epoch ( epoch ) metrics = { '/' . join ( list ( map ( lambda x : str ( x ) , k ) ) ) : v for k , v in df . groupby ( [ 'dataloader' , 'metric' , 'lookback' ] ) [ 'value' ] . mean ( ) . items ( ) } for metric_name , metric_value in metrics . items ( ) : self . writer . add_scalar ( metric_name , metric_value , global_step = epoch ) except KeyError : pass