# HG changeset patch # User James Bergstra # Date 1282672409 14400 # Node ID bee0ca674b2bd87029af52b92f29035c8a48a7c0 # Parent 78b5bdf967f614ff548f0d29e234e077b02e6b76 mcRBM - removed numpy_project_onto_ball diff -r 78b5bdf967f6 -r bee0ca674b2b pylearn/algorithms/mcRBM.py --- 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')