#NEWLINE# def __init__( self , experiment_name = 'experiment' , description = None , save_outputs = False , save_learning_rule = False , save_model = False , save_epoch_error = False , save_to_database = None , logger = None ) : #NEWLINE# #INDENT# self . experiment_name = experiment_name #NEWLINE# self . description = description #NEWLINE# self . save_outputs = save_outputs #NEWLINE# self . save_learning_rule = save_learning_rule #NEWLINE# self . save_model = save_model #NEWLINE# self . save_epoch_error = save_epoch_error #NEWLINE# self . save_to_database = save_to_database #NEWLINE# dt = datetime . now ( ) #NEWLINE# dt = dt . strftime ( '%Y%m%d_%H%M_%S%f' ) #NEWLINE# self . exp_id = ( ( experiment_name + '_' ) + dt ) #NEWLINE# if ( save_outputs or save_learning_rule or save_model ) : #NEWLINE# #INDENT# save_dir = os . environ [ 'PYNET_SAVE_PATH' ] #NEWLINE# if ( not os . path . exists ( save_dir ) ) : #NEWLINE# #INDENT# os . mkdir ( save_dir ) #NEWLINE# #UNINDENT# self . exp_dir = ( ( save_dir + '/' ) + self . exp_id ) #NEWLINE# if ( not os . path . exists ( self . exp_dir ) ) : #NEWLINE# #INDENT# os . mkdir ( self . exp_dir ) #NEWLINE# #UNINDENT# #UNINDENT# self . logger = logger #NEWLINE# if ( self . logger is None ) : #NEWLINE# #INDENT# self . logger = logging . getLogger ( __name__ ) #NEWLINE# self . logger . setLevel ( logging . DEBUG ) #NEWLINE# #UNINDENT# if save_outputs : #NEWLINE# #INDENT# ch = logging . FileHandler ( filename = ( self . exp_dir + '/outputs.log' ) ) #NEWLINE# ch . setLevel ( logging . INFO ) #NEWLINE# formatter = logging . Formatter ( '%(message)s' ) #NEWLINE# ch . setFormatter ( formatter ) #NEWLINE# self . logger . addHandler ( ch ) #NEWLINE# #UNINDENT# if save_epoch_error : #NEWLINE# #INDENT# self . epoch_error_tbl = { #NEWLINE# #INDENT# 'epoch' : [ ] , #NEWLINE# 'train_error' : [ ] , #NEWLINE# 'valid_error' : [ ] , #NEWLINE# 'test_error' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# self . logger . info ( ( 'exp_id: ' + self . exp_id ) ) #NEWLINE# if ( description is not None ) : #NEWLINE# #INDENT# self . logger . info ( ( 'Description: ' + self . description ) ) #NEWLINE# #UNINDENT# if save_to_database : #NEWLINE# #INDENT# self . first_time_record = True