<s> import theano <EOL> import theano . tensor as T <EOL> from io_func . data_io import read_data_args , read_dataset <EOL> from utils import parse_lrate , parse_activation , parse_conv_spec , activation_to_txt , string2bool <EOL> class RBMConfig ( ) : <EOL> def __init__ ( self ) : <EOL> self . epochs = <NUM_LIT:5> <EOL> self . batch_size = <NUM_LIT> <EOL> self . gbrbm_learning_rate = <NUM_LIT> <EOL> self . learning_rate = <NUM_LIT> <EOL> self . initial_momentum = <NUM_LIT:0.5> <EOL> self . final_momentum = <NUM_LIT> <EOL> self . initial_momentum_epoch = <NUM_LIT:5> <EOL> self . ptr_layer_number = <NUM_LIT:0> <EOL> self . first_layer_gb = True <EOL> self . train_sets = None <EOL> self . train_xy = None <EOL> self . train_x = None <EOL> self . train_y = None <EOL> self . valid_sets = None <EOL> self . valid_xy = None <EOL> self . valid_x = None <EOL> self . valid_y = None <EOL> self . n_ins = <NUM_LIT:0> <EOL> self . hidden_layers_sizes = [ ] <EOL> self . n_outs = <NUM_LIT:0> <EOL> self . cfg_output_file = '<STR_LIT>' <EOL> self . param_output_file = '<STR_LIT>' <EOL> self . kaldi_output_file = '<STR_LIT>' <EOL> def init_data_reading ( self , train_data_spec ) : <EOL> train_dataset , train_dataset_args = read_data_args ( train_data_spec ) <EOL> self . train_sets , self . train_xy , self . train_x , self . train_y = read_dataset ( train_dataset , train_dataset_args ) <EOL> def init_activation ( self ) : <EOL> self . activation = parse_activation ( self . activation_text ) <EOL> def parse_config_common ( self , arguments ) : <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . gbrbm_learning_rate = float ( arguments [ '<STR_LIT>' ] ) <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . learning_rate = float ( arguments [ '<STR_LIT>' ] ) <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . batch_size = int ( arguments [ '<STR_LIT>' ] ) <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . epochs = int ( arguments [ '<STR_LIT>' ] ) <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> momentum_elements = arguments [ '<STR_LIT>' ] . split ( '<STR_LIT::>' ) <EOL> if len ( momentum_elements ) != <NUM_LIT:3> : <EOL> print "<STR_LIT>" <EOL> exit ( <NUM_LIT:1> ) <EOL> self . initial_momentum = float ( momentum_elements [ <NUM_LIT:0> ] ) <EOL> self . final_momentum = float ( momentum_elements [ <NUM_LIT:1> ] ) <EOL> self . initial_momentum_epoch = int ( momentum_elements [ <NUM_LIT:2> ] ) <EOL> nnet_layers = arguments [ '<STR_LIT>' ] . split ( '<STR_LIT::>' ) <EOL> self . n_ins = int ( nnet_layers [ <NUM_LIT:0> ] ) <EOL> self . hidden_layers_sizes = [ int ( nnet_layers [ i ] ) for i in range ( <NUM_LIT:1> , len ( nnet_layers ) - <NUM_LIT:1> ) ] <EOL> self . n_outs = int ( nnet_layers [ - <NUM_LIT:1> ] ) <EOL> self . ptr_layer_number = len ( self . hidden_layers_sizes ) <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . ptr_layer_number = int ( arguments [ '<STR_LIT>' ] ) <EOL> if arguments . has_key ( '<STR_LIT>' ) and arguments [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> self . first_layer_gb = False <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . cfg_output_file = arguments [ '<STR_LIT>' ] <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . param_output_file = arguments [ '<STR_LIT>' ] <EOL> if arguments . has_key ( '<STR_LIT>' ) : <EOL> self . kaldi_output_file = arguments [ '<STR_LIT>' ] </s>
