#NEWLINE# def get_next_rate( self , current_error ) : #NEWLINE# #INDENT# if ( self . epoch >= self . max_epoch ) : #NEWLINE# #INDENT# self . rate = 0.0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . prev_error is not None ) : #NEWLINE# #INDENT# if ( current_error < ( self . prev_error * self . thres_inc ) ) : #NEWLINE# #INDENT# self . rate *= self . factor_inc #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( current_error >= ( self . prev_error * self . thres_dec ) ) : #NEWLINE# #INDENT# self . rate *= self . factor_dec #NEWLINE# #UNINDENT# #UNINDENT# if ( current_error >= ( self . prev_error * self . thres_fail ) ) : #NEWLINE# #INDENT# self . fails += 1 #NEWLINE# if ( self . fails >= self . max_fail ) : #NEWLINE# #INDENT# self . rate = 0.0 #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . fails = 0 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . epoch += 1 #NEWLINE# self . prev_error = current_error #NEWLINE# return current_error . rate