#NEWLINE# def __init__( self , monitor = 'val_loss' , patience = 0 , verbose = 0 , mode = 'auto' ) : #NEWLINE# #INDENT# super ( Callback , self ) . __init__ ( ) #NEWLINE# self . monitor = monitor #NEWLINE# self . patience = patience #NEWLINE# self . verbose = verbose #NEWLINE# self . wait = 0 #NEWLINE# if ( mode not in [ 'auto' , 'min' , 'max' ] ) : #NEWLINE# #INDENT# warnings . warn ( ( 'EarlyStopping mode %s is unknown, fallback to auto mode.' % self . mode ) , RuntimeWarning ) #NEWLINE# mode = 'auto' #NEWLINE# #UNINDENT# if ( mode == 'min' ) : #NEWLINE# #INDENT# self . monitor_op = np . less #NEWLINE# self . best = np . Inf #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mode == 'max' ) : #NEWLINE# #INDENT# self . monitor_op = np . greater #NEWLINE# self . best = ( - np . Inf ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'acc' in self . monitor ) : #NEWLINE# #INDENT# self . monitor_op = np . greater #NEWLINE# self . best = ( - np . Inf ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . monitor_op = np . less #NEWLINE# self . best = np . Inf