comparison sandbox/rbm/model.py @ 401:217c8789284b

Small updates
author Joseph Turian <turian@gmail.com>
date Wed, 09 Jul 2008 00:29:16 -0400
parents 269d5c5a4209
children ffdd2c199f2a
comparison
equal deleted inserted replaced
400:269d5c5a4209 401:217c8789284b
60 v = pylearn.sparse_instance.to_vector(instances, globals.INPUT_DIMENSION) 60 v = pylearn.sparse_instance.to_vector(instances, globals.INPUT_DIMENSION)
61 for i in range(iterations): 61 for i in range(iterations):
62 q = sigmoid(self.parameters.b + dot(v, self.parameters.w)) 62 q = sigmoid(self.parameters.b + dot(v, self.parameters.w))
63 h = sample(q) 63 h = sample(q)
64 p = sigmoid(self.parameters.c + dot(h, self.parameters.w.T)) 64 p = sigmoid(self.parameters.c + dot(h, self.parameters.w.T))
65 v = sample(p) 65 return p
66 return v
67 66
68 def update(self, instances): 67 def update(self, instances):
69 """ 68 """
70 Update the L{Model} using one training instance. 69 Update the L{Model} using one training instance.
71 @param instance: A dict from feature index to (non-zero) value. 70 @param instance: A dict from feature index to (non-zero) value.