changeset 16:b95fe82ac9ce

more notes to self
author Jeff Hammel <k0scist@gmail.com>
date Sun, 03 Sep 2017 13:17:33 -0700
parents 926c127305fa
children bf8bd42f8cd7
files tvii/logistic_regression.py tvii/sigmoid.py
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tvii/logistic_regression.py	Sun Sep 03 12:11:03 2017 -0700
+++ b/tvii/logistic_regression.py	Sun Sep 03 13:17:33 2017 -0700
@@ -12,6 +12,18 @@
 
 
 import numpy as np
+from .sigmoid import sigmoid
+
+def cost_function(_):
+    """
+    Cost function for binary classification
+    yhat = sigmoid(W.T*x + b)
+    interpret yhat thhe probably that y=1
+
+    Loss function:
+    y log(yhat) + (1- {UNFINISHED})
+    """
+    raise NotImplementedError('TODO')
 
 def logistic_regression(_):
     """the slow way"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tvii/sigmoid.py	Sun Sep 03 13:17:33 2017 -0700
@@ -0,0 +1,8 @@
+"""
+sigmoid function: 1/(1 + e^-z)
+"""
+
+import math
+
+def sigmoid(z):
+    return 1./(1. + math.exp(-z))