deepmorpheus/model.py
def validation_epoch_end(self, outputs):
        """Called when an validation epoch ends, this prints out the average loss and accuracy"""
        avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean()
        avg_acc = torch.stack([x['val_acc'] for x in outputs]).mean()
        print('Validation loss is %.2f, validation accuracy is %.2f%%' % (avg_loss, avg_acc * 100))

        log = {'val_loss': avg_loss, 'val_acc': avg_acc}

        for idx, tag_name in enumerate(self.vocab.tag_names):
            avg_tag_acc = torch.stack([x['acc_by_tag'][idx] for x in outputs]).mean()
            log['tag_acc_%s' % tag_name] = avg_tag_acc

        return {'avg_val_loss': avg_loss, 'log': log}
Called when an validation epoch ends, this prints out the average loss and accuracy
Called when an validation epoch ends, this prints out the average loss and accuracy
Called when an validation epoch ends this prints out the average loss and accuracy
def validation_epoch_end(self, outputs):
        avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean()
        avg_acc = torch.stack([x['val_acc'] for x in outputs]).mean()
        print('Validation loss is %.2f, validation accuracy is %.2f%%' % (avg_loss, avg_acc * 100))
        log = {'val_loss': avg_loss, 'val_acc': avg_acc}
        for idx, tag_name in enumerate(self.vocab.tag_names):
            avg_tag_acc = torch.stack([x['acc_by_tag'][idx] for x in outputs]).mean()
            log['tag_acc_%s' % tag_name] = avg_tag_acc
        return {'avg_val_loss': avg_loss, 'log': log}
def validation_epoch_end ( self , outputs ) : avg_loss = torch . stack ( [ x [ 'val_loss' ] for x in outputs ] ) . mean ( ) avg_acc = torch . stack ( [ x [ 'val_acc' ] for x in outputs ] ) . mean ( ) print ( 'Validation loss is %.2f, validation accuracy is %.2f%%' % ( avg_loss , avg_acc * 100 ) ) log = { 'val_loss' : avg_loss , 'val_acc' : avg_acc } for idx , tag_name in enumerate ( self . vocab . tag_names ) : avg_tag_acc = torch . stack ( [ x [ 'acc_by_tag' ] [ idx ] for x in outputs ] ) . mean ( ) log [ 'tag_acc_%s' % tag_name ] = avg_tag_acc return { 'avg_val_loss' : avg_loss , 'log' : log }
Called when an validation epoch ends, this prints out the average loss and accuracy
Called when an validation epoch ends this prints out the average loss and accuracy
"""Called when an validation epoch ends, this prints out the average loss and accuracy"""
self
outputs