changeset 986:bee0ca674b2b

mcRBM - removed numpy_project_onto_ball
author James Bergstra <bergstrj@iro.umontreal.ca>
date Tue, 24 Aug 2010 13:53:29 -0400
parents 78b5bdf967f6
children 043aa1b748a7
files pylearn/algorithms/mcRBM.py
diffstat 1 files changed, 7 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/mcRBM.py	Tue Aug 24 13:51:26 2010 -0400
+++ b/pylearn/algorithms/mcRBM.py	Tue Aug 24 13:53:29 2010 -0400
@@ -201,10 +201,6 @@
 from pylearn.sampling.hmc import HMC_sampler
 from pylearn.io import image_tiling
 
-from sparse_coding import numpy_project_onto_ball
-
-print >> sys.stderr, "mcRBM IS NOT READY YET"
-
 
 #TODO: This should be in the nnet part of the library
 def sgd_updates(params, grads, lr):
@@ -301,28 +297,17 @@
         """
         Return a MeanCovRBM instance with randomly-initialized parameters.
         """
-
-        
-        if 0:
-            if P_init == 'diag':
-                if n_K != n_F:
-                    raise ValueError('cannot use diagonal initialization of non-square P matrix')
-                import scipy.sparse
-                P =  -scipy.sparse.identity(n_K).tocsr()
-            else:
-                raise NotImplementedError()
-
         rng = np.random.RandomState(seed)
 
         # initialization taken from Marc'Aurelio
 
         return cls(
-                #U = numpy_project_onto_ball(rng.randn(n_I, n_F).T).T,
-                U = 0.2 * rng.randn(n_I, n_F),
-                W = rng.randn(n_I, n_J)/np.sqrt((n_I+n_J)/2),
-                a = np.ones(n_I)*(-2),
+                U = 0.02 * rng.randn(n_I, n_F),
+                W = 0.05 * rng.randn(n_I, n_J),
+                #W = rng.randn(n_I, n_J)/np.sqrt((n_I+n_J)/2),
+                a = np.ones(n_I)*(0),
                 b = np.ones(n_K)*2,
-                c = np.zeros(n_J),)
+                c = np.ones(n_J)*(-2),)
 
     def __getstate__(self):
         # unpack shared containers, which may have references to Theano stuff
@@ -370,7 +355,9 @@
 
 from pylearn.dataset_ops.protocol import TensorFnDataset
 from pylearn.dataset_ops.memo import memo
+import pylearn
 import scipy.io
+import os
 @memo
 def load_mcRBM_demo_patches():
     d = scipy.io.loadmat('/u/bergstrj/cvs/articles/2010/spike_slab_RBM/src/marcaurelio/training_colorpatches_16x16_demo.mat')