diff tests/test_logistic_regression.py @ 22:3713c6733990

[logistic regression] introduce illustrative test
author Jeff Hammel <k0scist@gmail.com>
date Mon, 04 Sep 2017 08:59:52 -0700
parents b6a146f0a61b
children f34110e28a0a
line wrap: on
line diff
--- a/tests/test_logistic_regression.py	Mon Sep 04 08:37:06 2017 -0700
+++ b/tests/test_logistic_regression.py	Mon Sep 04 08:59:52 2017 -0700
@@ -4,13 +4,24 @@
 test logistic regression
 """
 
+import numpy as np
 import os
 import unittest
 from tvii import logistic_regression
 
 class LogisticRegresionTests(unittest.TestCase):
-    def test_basic(self):
-        """placeholder"""
+
+    def test_cost(self):
+        """test cost function"""
+
+        w, b, X, Y = (np.array([[1],[2]]),
+                      2,
+                      np.array([[1,2],[3,4]]),
+                      np.array([[1,0]]))
+
+        expected_cost = 6.000064773192205
+        cost = logistic_regression.cost_function(w, b, X, Y)
+        print cost
 
 if __name__ == '__main__':
     unittest.main()