changeset 870:2fffbfa41920

merge
author James Bergstra <bergstrj@iro.umontreal.ca>
date Tue, 10 Nov 2009 17:59:54 -0500
parents 6298876b2b01 (current diff) c3e7ae2bdb4b (diff)
children fafe796ad5ff
files
diffstat 4 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dataset_ops/cifar10.py	Mon Nov 09 14:55:08 2009 -0500
+++ b/pylearn/dataset_ops/cifar10.py	Tue Nov 10 17:59:54 2009 -0500
@@ -13,7 +13,7 @@
 import theano
 
 from protocol import TensorFnDataset # protocol.py __init__.py
-from .memo import memo
+from .memo import memo # memo.py
 
 def _unpickle(filename, dtype):
     #implements loading as well as dtype-conversion and dtype-scaling
--- a/pylearn/dataset_ops/memo.py	Mon Nov 09 14:55:08 2009 -0500
+++ b/pylearn/dataset_ops/memo.py	Tue Nov 10 17:59:54 2009 -0500
@@ -20,6 +20,7 @@
     def forget():
         for k in cache.keys():
             del cache[k]
+    rval.cache = cache
     rval.forget = forget
     rval.__name__ = 'memo@%s'%f.__name__
     return rval
--- a/pylearn/shared/layers/lecun1998.py	Mon Nov 09 14:55:08 2009 -0500
+++ b/pylearn/shared/layers/lecun1998.py	Tue Nov 10 17:59:54 2009 -0500
@@ -96,8 +96,12 @@
         w_shp = (n_filters, n_imgs) + filter_shape
         b_shp = (n_filters,)
 
-        w = shared(numpy.asarray(rng.uniform(low=-.05, high=.05, size=w_shp), dtype=dtype))
-        b = shared(numpy.asarray(rng.uniform(low=-.05, high=.05, size=b_shp), dtype=dtype))
+        #TODO: make w_range a parameter to new as well?
+        w_range = (-1.0 / numpy.sqrt(filter_shape[0] * filter_shape[1] * n_imgs),
+                   1.0 / numpy.sqrt(filter_shape[0] * filter_shape[1] * n_imgs))
+
+        w = shared(numpy.asarray(rng.uniform(low=w_range[0], high=w_range[1], size=w_shp), dtype=dtype))
+        b = shared(numpy.asarray(rng.uniform(low=-.0, high=0., size=b_shp), dtype=dtype))
 
         if isinstance(squash_fn, str):
             squash_fn = squash(squash_fn)
--- a/pylearn/shared/layers/rust2005.py	Mon Nov 09 14:55:08 2009 -0500
+++ b/pylearn/shared/layers/rust2005.py	Tue Nov 10 17:59:54 2009 -0500
@@ -241,8 +241,8 @@
         b_shp = (n_filters,)
 
         if w_range is None:
-            w_low = -2.0/numpy.sqrt(image_shape[0] * image_shape[1])
-            w_high = 2.0/numpy.sqrt(image_shape[0] * image_shape[1])
+            w_low = -2.0/numpy.sqrt(image_shape[0] * image_shape[1] * n_channels)
+            w_high = 2.0/numpy.sqrt(image_shape[0] * image_shape[1] * n_channels)
         else:
             w_low, w_high = w_range