Mercurial > pylearn
comparison simple_autoassociator/model.py @ 392:e2cb8d489908
More debugging
author | Joseph Turian <turian@gmail.com> |
---|---|
date | Tue, 08 Jul 2008 18:45:35 -0400 |
parents | ec8aadb6694d |
children |
comparison
equal
deleted
inserted
replaced
389:ec8aadb6694d | 392:e2cb8d489908 |
---|---|
26 """ | 26 """ |
27 x = numpy.zeros(globals.INPUT_DIMENSION) | 27 x = numpy.zeros(globals.INPUT_DIMENSION) |
28 for idx in instance.keys(): | 28 for idx in instance.keys(): |
29 x[idx] = instance[idx] | 29 x[idx] = instance[idx] |
30 | 30 |
31 (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2) | 31 (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2, gy) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2) |
32 print | 32 print |
33 print "instance:", instance | 33 print "instance:", instance |
34 print "x:", x | 34 print "x:", x |
35 print "OLD y:", y | 35 print "OLD y:", y |
36 print "NEW loss (unsummed):", loss_unsummed | 36 print "OLD loss (unsummed):", loss_unsummed |
37 print "gy:", gy | |
37 print "OLD total loss:", loss | 38 print "OLD total loss:", loss |
38 print "gw1:", gw1 | 39 print "gw1:", gw1 |
39 print "gb1:", gb1 | 40 print "gb1:", gb1 |
40 print "gw2:", gw2 | 41 print "gw2:", gw2 |
41 print "gb2:", gb2 | 42 print "gb2:", gb2 |
45 self.parameters.b1 -= LR * gb1 | 46 self.parameters.b1 -= LR * gb1 |
46 self.parameters.w2 -= LR * gw2 | 47 self.parameters.w2 -= LR * gw2 |
47 self.parameters.b2 -= LR * gb2 | 48 self.parameters.b2 -= LR * gb2 |
48 | 49 |
49 # Recompute the loss, to make sure it's descreasing | 50 # Recompute the loss, to make sure it's descreasing |
50 (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2) | 51 (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2, gy) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2) |
51 print "NEW y:", y | 52 print "NEW y:", y |
52 print "NEW loss (unsummed):", loss_unsummed | 53 print "NEW loss (unsummed):", loss_unsummed |
54 print "gy:", gy | |
53 print "NEW total loss:", loss | 55 print "NEW total loss:", loss |
54 print h | 56 print "h:", h |
55 print self.parameters | 57 print self.parameters |