diff simple_autoassociator.py/model.py @ 388:98ca97cc9910

Debugging simple AA
author Joseph Turian <turian@gmail.com>
date Tue, 08 Jul 2008 17:41:26 -0400
parents a474341861fa
children
line wrap: on
line diff
--- a/simple_autoassociator.py/model.py	Tue Jul 08 17:08:23 2008 -0400
+++ b/simple_autoassociator.py/model.py	Tue Jul 08 17:41:26 2008 -0400
@@ -28,11 +28,17 @@
         for idx in instance.keys():
             x[idx] = instance[idx]
 
-        (y, loss, 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) = 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 total loss:", loss
+        print "gw1:", gw1
+        print "gb1:", gb1
+        print "gw2:", gw2
+        print "gb2:", gb2
 
         # SGD update
         self.parameters.w1  -= LR * gw1
@@ -41,6 +47,9 @@
         self.parameters.b2  -= LR * gb2
 
         # Recompute the loss, to make sure it's descreasing
-        (y, loss, 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) = 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 "NEW total loss:", loss
+        print h
+        print self.parameters