#NEWLINE# def __init__( self , notification_names , min_iterations = None , min_epochs = None , patience_factor = 1.5 , patience_log_record = None , **kwargs ) : #NEWLINE# #INDENT# if ( ( min_epochs is None ) == ( min_iterations is None ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Need exactly one of epochs or iterations to be specified' ) #NEWLINE# #UNINDENT# self . notification_names = notification_names #NEWLINE# self . min_iterations = min_iterations #NEWLINE# self . min_epochs = min_epochs #NEWLINE# self . patience_factor = patience_factor #NEWLINE# kwargs . setdefault ( 'after_epoch' , True ) #NEWLINE# kwargs . setdefault ( 'before_first_epoch' , True ) #NEWLINE# self . last_best_iter = self . last_best_epoch = 0 #NEWLINE# if ( min_iterations is None ) : #NEWLINE# #INDENT# self . patience_log_record = ( 'patience' + ( '_epochs' if ( self . min_epochs is not None ) else '_iterations' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . patience_log_record = patience_log_record #NEWLINE# #UNINDENT# super ( Patience , self ) . __init__ ( ** kwargs )