Mercurial > ift6266
comparison deep/stacked_dae/v_sylvain/nist_sda_retrieve.py @ 317:067e747fd9c0
Ajout de noms differents pour les series produites pour differents choix de pretrain
author | SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca> |
---|---|
date | Thu, 01 Apr 2010 20:09:14 -0400 |
parents | 60e82846a10d |
children | 71ffe2c9bfad |
comparison
equal
deleted
inserted
replaced
316:60e82846a10d | 317:067e747fd9c0 |
---|---|
53 | 53 |
54 n_ins = 32*32 | 54 n_ins = 32*32 |
55 n_outs = 62 # 10 digits, 26*2 (lower, capitals) | 55 n_outs = 62 # 10 digits, 26*2 (lower, capitals) |
56 | 56 |
57 examples_per_epoch = NIST_ALL_TRAIN_SIZE | 57 examples_per_epoch = NIST_ALL_TRAIN_SIZE |
58 | 58 #To be sure variables will not be only in the if statement |
59 series = create_series(state.num_hidden_layers) | 59 PATH = '' |
60 nom_reptrain = '' | |
61 nom_serie = "" | |
62 if state['pretrain_choice'] == 0: | |
63 PATH=PATH_NIST | |
64 nom_pretrain='NIST' | |
65 nom_serie="series_NIST.h5" | |
66 elif state['pretrain_choice'] == 1: | |
67 PATH=PATH_P07 | |
68 nom_pretrain='P07' | |
69 nom_serie="series_P07.h5" | |
70 | |
71 series = create_series(state.num_hidden_layers,nom_serie) | |
60 | 72 |
61 print "Creating optimizer with state, ", state | 73 print "Creating optimizer with state, ", state |
62 | 74 |
63 optimizer = SdaSgdOptimizer(dataset=datasets.nist_all(), | 75 optimizer = SdaSgdOptimizer(dataset=datasets.nist_all(), |
64 hyperparameters=state, \ | 76 hyperparameters=state, \ |
81 ## sys.exit("The code does not support this much pretraining epoch (99 max with P07).\n"+ | 93 ## sys.exit("The code does not support this much pretraining epoch (99 max with P07).\n"+ |
82 ## "You have to correct the code (and be patient, P07 is huge !!)\n"+ | 94 ## "You have to correct the code (and be patient, P07 is huge !!)\n"+ |
83 ## "or reduce the number of pretraining epoch to run the code (better idea).\n") | 95 ## "or reduce the number of pretraining epoch to run the code (better idea).\n") |
84 ## print('\n\tpretraining with P07') | 96 ## print('\n\tpretraining with P07') |
85 ## optimizer.pretrain(datasets.nist_P07(min_file=0,max_file=nb_file)) | 97 ## optimizer.pretrain(datasets.nist_P07(min_file=0,max_file=nb_file)) |
86 if state['pretrain_choice'] == 0: | |
87 PATH=PATH_NIST | |
88 nom_pretrain='NIST' | |
89 elif state['pretrain_choice'] == 1: | |
90 PATH=PATH_P07 | |
91 nom_pretrain='P07' | |
92 | 98 |
93 print ('Retrieve pre-train done earlier ( '+nom_pretrain+' )') | 99 print ('Retrieve pre-train done earlier ( '+nom_pretrain+' )') |
94 | 100 |
95 | 101 |
96 | 102 |
166 | 172 |
167 return channel.COMPLETE | 173 return channel.COMPLETE |
168 | 174 |
169 # These Series objects are used to save various statistics | 175 # These Series objects are used to save various statistics |
170 # during the training. | 176 # during the training. |
171 def create_series(num_hidden_layers): | 177 def create_series(num_hidden_layers, nom_serie): |
172 | 178 |
173 # Replace series we don't want to save with DummySeries, e.g. | 179 # Replace series we don't want to save with DummySeries, e.g. |
174 # series['training_error'] = DummySeries() | 180 # series['training_error'] = DummySeries() |
175 | 181 |
176 series = {} | 182 series = {} |
177 | 183 |
178 basedir = os.getcwd() | 184 basedir = os.getcwd() |
179 | 185 |
180 h5f = tables.openFile(os.path.join(basedir, "series.h5"), "w") | 186 h5f = tables.openFile(os.path.join(basedir, nom_serie), "w") |
181 | 187 |
182 # reconstruction | 188 # reconstruction |
183 reconstruction_base = \ | 189 reconstruction_base = \ |
184 ErrorSeries(error_name="reconstruction_error", | 190 ErrorSeries(error_name="reconstruction_error", |
185 table_name="reconstruction_error", | 191 table_name="reconstruction_error", |