comparison deep/convolutional_dae/scdae.py @ 314:2937f2a421aa

Print the error sometimes in the pretrain loop.
author Arnaud Bergeron <abergeron@gmail.com>
date Thu, 01 Apr 2010 14:28:50 -0400
parents ef28cbb5f464
children 6143b23e2610
comparison
equal deleted inserted replaced
311:8b31280129a9 314:2937f2a421aa
155 def create_series(): 155 def create_series():
156 import tables 156 import tables
157 157
158 series = {} 158 series = {}
159 h5f = tables.openFile('series.h5', 'w') 159 h5f = tables.openFile('series.h5', 'w')
160 class PrintWrap(object):
161 def __init__(self, series):
162 self.series = series
163
164 def append(self, idx, value):
165 print idx, value
166 self.series.append(idx, value)
160 167
161 series['recons_error'] = AccumulatorSeriesWrapper( 168 series['recons_error'] = AccumulatorSeriesWrapper(
162 base_series=ErrorSeries(error_name='reconstruction_error', 169 base_series=PrintWrap(ErrorSeries(error_name='reconstruction_error',
163 table_name='reconstruction_error', 170 table_name='reconstruction_error',
164 hdf5_file=h5f, 171 hdf5_file=h5f,
165 index_names=('layer', 'epoch'), 172 index_names=('layer', 'epoch'),
166 title="Reconstruction error (mse)"), 173 title="Reconstruction error (mse)")),
167 reduce_every=100) 174 reduce_every=100)
168 175
169 series['train_error'] = AccumulatorSeriesWrapper( 176 series['train_error'] = AccumulatorSeriesWrapper(
170 base_series=ErrorSeries(error_name='training_error', 177 base_series=ErrorSeries(error_name='training_error',
171 table_name='training_error', 178 table_name='training_error',
201 dset = datasets.nist_digits(1000) 208 dset = datasets.nist_digits(1000)
202 209
203 pretrain_funcs, trainf, evalf, net = build_funcs( 210 pretrain_funcs, trainf, evalf, net = build_funcs(
204 img_size = (32, 32), 211 img_size = (32, 32),
205 batch_size=batch_size, filter_sizes=[(5,5), (3,3)], 212 batch_size=batch_size, filter_sizes=[(5,5), (3,3)],
206 num_filters=[12, 4], subs=[(2,2), (2,2)], noise=[0.2, 0.2], 213 num_filters=[20, 4], subs=[(2,2), (2,2)], noise=[0.2, 0.2],
207 mlp_sizes=[500], out_size=10, dtype=numpy.float32, 214 mlp_sizes=[500], out_size=10, dtype=numpy.float32,
208 pretrain_lr=0.001, train_lr=0.1) 215 pretrain_lr=0.001, train_lr=0.1)
209 216
210 t_it = repeat_itf(dset.train, batch_size) 217 t_it = repeat_itf(dset.train, batch_size)
211 pretrain_fs, train, valid, test = massage_funcs( 218 pretrain_fs, train, valid, test = massage_funcs(