diff 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
line wrap: on
line diff
--- a/simple_autoassociator/model.py	Tue Jul 08 17:41:45 2008 -0400
+++ b/simple_autoassociator/model.py	Tue Jul 08 18:45:35 2008 -0400
@@ -28,12 +28,13 @@
         for idx in instance.keys():
             x[idx] = instance[idx]
 
-        (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2)
+        (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2, gy) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2)
         print
         print "instance:", instance
         print "x:", x
         print "OLD y:", y
-        print "NEW loss (unsummed):", loss_unsummed
+        print "OLD loss (unsummed):", loss_unsummed
+        print "gy:", gy
         print "OLD total loss:", loss
         print "gw1:", gw1
         print "gb1:", gb1
@@ -47,9 +48,10 @@
         self.parameters.b2  -= LR * gb2
 
         # Recompute the loss, to make sure it's descreasing
-        (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2)
+        (y, h, loss, loss_unsummed, gw1, gb1, gw2, gb2, gy) = trainfn(x, self.parameters.w1, self.parameters.b1, self.parameters.w2, self.parameters.b2)
         print "NEW y:", y
         print "NEW loss (unsummed):", loss_unsummed
+        print "gy:", gy
         print "NEW total loss:", loss
-        print h
+        print "h:", h
         print self.parameters