diff 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
line wrap: on
line diff
--- a/deep/convolutional_dae/scdae.py	Thu Apr 01 13:44:30 2010 -0400
+++ b/deep/convolutional_dae/scdae.py	Thu Apr 01 14:28:50 2010 -0400
@@ -157,13 +157,20 @@
 
     series = {}
     h5f = tables.openFile('series.h5', 'w')
+    class PrintWrap(object):
+        def __init__(self, series):
+            self.series = series
+
+        def append(self, idx, value):
+            print idx, value
+            self.series.append(idx, value)
 
     series['recons_error'] = AccumulatorSeriesWrapper(
-        base_series=ErrorSeries(error_name='reconstruction_error',
-                                table_name='reconstruction_error',
-                                hdf5_file=h5f,
-                                index_names=('layer', 'epoch'),
-                                title="Reconstruction error (mse)"),
+        base_series=PrintWrap(ErrorSeries(error_name='reconstruction_error',
+                                          table_name='reconstruction_error',
+                                          hdf5_file=h5f,
+                                          index_names=('layer', 'epoch'),
+                                          title="Reconstruction error (mse)")),
         reduce_every=100)
         
     series['train_error'] = AccumulatorSeriesWrapper(
@@ -203,7 +210,7 @@
     pretrain_funcs, trainf, evalf, net = build_funcs(
         img_size = (32, 32),
         batch_size=batch_size, filter_sizes=[(5,5), (3,3)],
-        num_filters=[12, 4], subs=[(2,2), (2,2)], noise=[0.2, 0.2],
+        num_filters=[20, 4], subs=[(2,2), (2,2)], noise=[0.2, 0.2],
         mlp_sizes=[500], out_size=10, dtype=numpy.float32,
         pretrain_lr=0.001, train_lr=0.1)