changeset 1330:3efd0effb2a7

small changes to mode dataset (used for tempering work)
author gdesjardins
date Thu, 14 Oct 2010 23:55:41 -0400
parents 0f69f303ba91
children 0541e7d6e916
files pylearn/datasets/test_modes.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/datasets/test_modes.py	Thu Oct 14 23:54:28 2010 -0400
+++ b/pylearn/datasets/test_modes.py	Thu Oct 14 23:55:41 2010 -0400
@@ -99,7 +99,8 @@
 
     def __init__(self, n_modes, img_shape, seed=238904, 
                  min_p=1e-4, max_p=1e-1,
-                 min_w=0., max_w=1.):
+                 min_w=0., max_w=1.,
+                 w = None, p = None):
 
         self.n_modes = n_modes
         self.img_shape = img_shape
@@ -107,9 +108,14 @@
         self.img_size = numpy.prod(img_shape)
 
         # generate random p, w values
-        self.p = min_p + self.rng.rand(n_modes) * (max_p - min_p)
-        w = min_w + self.rng.rand(n_modes) * (max_w - min_w)
+        if p is None:
+            p = min_p + self.rng.rand(n_modes) * (max_p - min_p)
+        self.p = p
+
+        if w is None:
+            w = min_w + self.rng.rand(n_modes) * (max_w - min_w)
         self.w = w / numpy.sum(w)
+
         self.sort_w_idx = numpy.argsort(self.w)
 
         self.modes = self.rng.randint(0,2,size=(n_modes,self.img_size))