In [9]:
import random

sf_height = [random.randint(80, 160) for x in range(200)]
ny_height = [random.randint(130, 200) for x in range(200)]

In [34]:
data = map(lambda x: (x,1), sf_height)
data += map(lambda x: (x,0), ny_height)

datamap = {}
for (x, y) in data:
    datamap[x] = y

In [30]:
import numpy as np
theta = np.array([[1],[1]])

In [28]:
def hypo(x):
    vecx = np.array([[1],[x]])
    return np.dot(np.transpose(theta), vecx)[0][0]

In [36]:
def get_y(x):
    return datamap[x]

In [41]:
def errorfn(x):
    return (hypo(x) - get_y(x))

In [43]:
def calcu():
    tmp = theta[:]

In [ ]: