# HG changeset patch # User James Bergstra # Date 1257893324 18000 # Node ID aaaed35c995e4b43ef1bf0dfc5afc5a7bddcf9a7 # Parent 9b13f7bb00efae5ad29267cc65619c106ed1f860 improved the initialization range for weights in lecun1998 diff -r 9b13f7bb00ef -r aaaed35c995e pylearn/shared/layers/lecun1998.py --- a/pylearn/shared/layers/lecun1998.py Tue Nov 10 17:44:36 2009 -0500 +++ b/pylearn/shared/layers/lecun1998.py Tue Nov 10 17:48:44 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)