#NEWLINE# def on_epoch_end( self , epoch , logs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# filepath = self . filepath . format ( epoch = epoch , ** logs ) #NEWLINE# if self . save_best_only : #NEWLINE# #INDENT# current = logs . get ( self . monitor ) #NEWLINE# if ( current is None ) : #NEWLINE# #INDENT# warnings . warn ( ( 'Can save best model only with %s available, skipping.' % self . monitor ) , RuntimeWarning ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . monitor_op ( current , self . best ) : #NEWLINE# #INDENT# if ( self . verbose > 0 ) : #NEWLINE# #INDENT# print ( ( 'Epoch %05d: %s improved from %0.5f to %0.5f, saving model to %s' % ( epoch , self . monitor , self . best , current , filepath ) ) ) #NEWLINE# #UNINDENT# self . best = current #NEWLINE# self . model . save_weights ( filepath , overwrite = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . verbose > 0 ) : #NEWLINE# #INDENT# print ( ( 'Epoch %05d: %s did not improve' % ( epoch , self . monitor ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . verbose > 0 ) : #NEWLINE# #INDENT# print ( ( 'Epoch %05d: saving model to %s' % ( epoch , filepath ) ) ) #NEWLINE# #UNINDENT# self . model . save_weights ( filepath , overwrite = True )