changeset 11:b6a146f0a61b

[logistic regression] stubbing
author Jeff Hammel <k0scist@gmail.com>
date Sun, 03 Sep 2017 11:27:47 -0700
parents aeba5d141efd
children 8d25213513b4
files tests/test_logistic_regression.py tvii/logistic_regression.py
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_logistic_regression.py	Sun Sep 03 11:27:47 2017 -0700
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+"""
+test logistic regression
+"""
+
+import os
+import unittest
+from tvii import logistic_regression
+
+class LogisticRegresionTests(unittest.TestCase):
+    def test_basic(self):
+        """placeholder"""
+
+if __name__ == '__main__':
+    unittest.main()
--- a/tvii/logistic_regression.py	Fri Sep 01 12:46:03 2017 -0700
+++ b/tvii/logistic_regression.py	Sun Sep 03 11:27:47 2017 -0700
@@ -2,4 +2,23 @@
 z = w'x + b
 a = sigmoid(z)
 L(a,y) = -(y*log(a) + (1-y)*log(1-a))
+
+    [|  |  | ]
+X = [x1 x2 x3]
+    [|  |  | ]
+
+[z1 z2 z3 .. zm] = w'*X + [b b b b ] = [w'*x1+b + w'*x2+b ...]
 """
+
+
+import numpy as np
+
+def logistic_regression(nx):
+    dw = np.zeros(nx)
+    # TODO
+    # z = np.dot(wT, x) + b  # "boradcasting
+    raise NotImplementedError('TODO')
+
+# derivativs:
+# dz1 = a1 - y1 ; dz2 = a2 - y2 ; ....
+# dZ = [ dz1 dz2 ... dzm ]