# HG changeset patch # User Jeff Hammel # Date 1504463267 25200 # Node ID b6a146f0a61b42df5d875fefc8b62f32a2257e3a # Parent aeba5d141efd304dee8685b3395e23f302ecd3f2 [logistic regression] stubbing diff -r aeba5d141efd -r b6a146f0a61b tests/test_logistic_regression.py --- /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() diff -r aeba5d141efd -r b6a146f0a61b tvii/logistic_regression.py --- 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 ]