(self, metadata)
Handle ``EarlyStoppingException``.
Handle ``EarlyStoppingException``.
Handle EarlyStoppingException .
def on_train_interrupt(self, metadata):
        """Handle ``EarlyStoppingException``."""
        ex = metadata['exception']

        if isinstance(ex, EarlyStoppingException):
            msg = 'Training stopped early because there was no improvement in {}_{} for {} epochs'.format(
                self.dataloader_name, self.metric_name, self.patience)
            print(msg)
def on_train_interrupt ( self , metadata ) : ex = metadata [ 'exception' ] if isinstance ( ex , EarlyStoppingException ) : msg = 'Training stopped early because there was no improvement in {}_{} for {} epochs' . format ( self . dataloader_name , self . metric_name , self . patience ) print ( msg )