changeset 1273:7bb5dd98e671

mcRBM - added hack to main script to pickle final model and sampler
author James Bergstra <bergstrj@iro.umontreal.ca>
date Wed, 08 Sep 2010 13:05:02 -0400
parents ba25c6e4f55d
children 9d5905d6d879
files pylearn/algorithms/mcRBM.py pylearn/algorithms/tests/test_mcRBM.py
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/mcRBM.py	Sat Sep 04 19:32:27 2010 -0400
+++ b/pylearn/algorithms/mcRBM.py	Wed Sep 08 13:05:02 2010 -0400
@@ -561,4 +561,10 @@
 
 if __name__ == '__main__':
     import pylearn.algorithms.tests.test_mcRBM
-    pylearn.algorithms.tests.test_mcRBM.test_reproduce_ranzato_hinton_2010(as_unittest=True)
+    rbm,smplr = pylearn.algorithms.tests.test_mcRBM.test_reproduce_ranzato_hinton_2010(
+            as_unittest=False,
+            n_train_iters=10)
+    import cPickle
+    cPickle.dump(rbm, open('mcRBM.rbm.pkl', 'w'), -1)
+    cPickle.dump(smplr, open('mcRBM.smplr.pkl', 'w'), -1)
+
--- a/pylearn/algorithms/tests/test_mcRBM.py	Sat Sep 04 19:32:27 2010 -0400
+++ b/pylearn/algorithms/tests/test_mcRBM.py	Wed Sep 08 13:05:02 2010 -0400
@@ -1,6 +1,6 @@
 from pylearn.algorithms.mcRBM import *
 
-def test_reproduce_ranzato_hinton_2010(dataset='MAR', as_unittest=True):
+def test_reproduce_ranzato_hinton_2010(dataset='MAR', as_unittest=True, n_train_iters=5000):
     dataset='MAR'
     if dataset == 'MAR':
         n_vis=105
@@ -10,8 +10,6 @@
         n_vis=R*C
         n_patches=100000
 
-    n_train_iters=5000
-
     n_burnin_steps=10000
 
 
@@ -137,3 +135,5 @@
             print "Activating L1 weight decay"
             effective_l1_penalty = 1e-3
 
+    if not as_unittest:
+        return rbm, smplr