Mercurial > pylearn
comparison sandbox/rbm/model.py @ 410:3cd4cfda2599
XENT per instance
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Fri, 11 Jul 2008 01:33:27 -0400 |
parents | c2e6a8fcc35e |
children | 4f61201fa9a9 |
comparison
equal
deleted
inserted
replaced
409:cf22ebfc90eb | 410:3cd4cfda2599 |
---|---|
87 @todo: Multiply L{self.weight_decay} by L{self.learning_rate}, as done in Semantic Hashing? | 87 @todo: Multiply L{self.weight_decay} by L{self.learning_rate}, as done in Semantic Hashing? |
88 @todo: Decay the biases too? | 88 @todo: Decay the biases too? |
89 """ | 89 """ |
90 minibatch = len(instances) | 90 minibatch = len(instances) |
91 v0 = pylearn.sparse_instance.to_vector(instances, self.input_dimension) | 91 v0 = pylearn.sparse_instance.to_vector(instances, self.input_dimension) |
92 print "old XENT:", numpy.sum(self.deterministic_reconstruction_error(v0)) | 92 print "old XENT per instance:", numpy.sum(self.deterministic_reconstruction_error(v0))/minibatch |
93 q0 = sigmoid(self.parameters.b + dot(v0, self.parameters.w)) | 93 q0 = sigmoid(self.parameters.b + dot(v0, self.parameters.w)) |
94 h0 = sample(q0) | 94 h0 = sample(q0) |
95 p0 = sigmoid(self.parameters.c + dot(h0, self.parameters.w.T)) | 95 p0 = sigmoid(self.parameters.c + dot(h0, self.parameters.w.T)) |
96 v1 = sample(p0) | 96 v1 = sample(p0) |
97 q1 = sigmoid(self.parameters.b + dot(v1, self.parameters.w)) | 97 q1 = sigmoid(self.parameters.b + dot(v1, self.parameters.w)) |
108 | 108 |
109 self.last_dw = dw | 109 self.last_dw = dw |
110 self.last_db = db | 110 self.last_db = db |
111 self.last_dc = dc | 111 self.last_dc = dc |
112 | 112 |
113 print "new XENT:", numpy.sum(self.deterministic_reconstruction_error(v0)) | 113 print "new XENT per instance:", numpy.sum(self.deterministic_reconstruction_error(v0))/minibatch |
114 | 114 |
115 # print | 115 # print |
116 # print "v[0]:", v0 | 116 # print "v[0]:", v0 |
117 # print "Q(h[0][i] = 1 | v[0]):", q0 | 117 # print "Q(h[0][i] = 1 | v[0]):", q0 |
118 # print "h[0]:", h0 | 118 # print "h[0]:", h0 |