comparison sandbox/rbm/parameters.py @ 396:e0c9357456e0

Bug fixed in RBM
author Joseph Turian <turian@gmail.com>
date Tue, 08 Jul 2008 20:37:36 -0400
parents 70019965f888
children c2e6a8fcc35e
comparison
equal deleted inserted replaced
395:70019965f888 396:e0c9357456e0
16 according to the given seed. If False, then just use zeroes. 16 according to the given seed. If False, then just use zeroes.
17 """ 17 """
18 if randomly_initialize: 18 if randomly_initialize:
19 numpy.random.seed(seed) 19 numpy.random.seed(seed)
20 self.w = (numpy.random.rand(input_dimension, hidden_dimension)-0.5)/input_dimension 20 self.w = (numpy.random.rand(input_dimension, hidden_dimension)-0.5)/input_dimension
21 self.b = numpy.zeros(hidden_dimension) 21 self.b = numpy.zeros((1, hidden_dimension))
22 self.c = numpy.zeros(input_dimension) 22 self.c = numpy.zeros((1, input_dimension))
23 else: 23 else:
24 self.w = numpy.zeros((input_dimension, hidden_dimension)) 24 self.w = numpy.zeros((input_dimension, hidden_dimension))
25 self.b = numpy.zeros(hidden_dimension) 25 self.b = numpy.zeros((1, hidden_dimension))
26 self.c = numpy.zeros(input_dimension) 26 self.c = numpy.zeros((1, input_dimension))
27 27
28 def __str__(self): 28 def __str__(self):
29 s = "" 29 s = ""
30 s += "w: %s\n" % self.w 30 s += "w: %s\n" % self.w
31 s += "b: %s\n" % self.b 31 s += "b: %s\n" % self.b