changeset 736:331f35215ea5

Fixed the SGD tests
author Olivier Delalleau <delallea@iro>
date Wed, 27 May 2009 15:25:56 -0400
parents 3784ef7cdd71
children 838646fcf679
files pylearn/algorithms/tests/test_sgd.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/tests/test_sgd.py	Wed May 27 14:46:01 2009 -0400
+++ b/pylearn/algorithms/tests/test_sgd.py	Wed May 27 15:25:56 2009 -0400
@@ -12,9 +12,9 @@
     m.y = 5.0
     for i in xrange(100):
         c = m.step_cost(3.0)
-        # print c, m.y
+        #print c[0], m.y
 
-    assert c < 1.0e-5
+    assert c[0] < 1.0e-5
     assert abs(m.y - (1.0 / 3)) < 1.0e-4
 
 def test_sgd_stepsize_variable():
@@ -33,7 +33,7 @@
         c = m.step_cost(3.0)
         # print c, m.y
 
-    assert c < 1.0e-5
+    assert c[0] < 1.0e-5
     assert abs(m.y - (1.0 / 3)) < 1.0e-4
 
 
@@ -63,6 +63,8 @@
         c = m.step_cost(3.0)
         # print c, m.y
 
-    assert c < 1.0e-5
+    assert c[0] < 1.0e-5
     assert abs(m.y - (1.0 / 3)) < 1.0e-4
 
+if __name__ == '__main__':
+    test_sgd0()