import numpy as np
import random
h0 = np.random.random()
h1 = np.random.random()
h2 = np.random.random()
h = np.array([h1,h2])
x=np.array([[2014,3],[1600,3],[2400,2],[1416,2],[3000,4]])
t=np.array([400,330,369,232,540])
a = 0.001
eps = 1e-4
e0 = 10
e1 = 10
e2 = 10
i=random.randint(0,4)
while e0>=eps or e1>=eps or e2>=eps:
e0 =(np.sum((x[i,0:2]*h[0]))+h0*1-t[i])
e1 = e0*x[i,0]
e2 = e0*x[i,1]
h0 = h0-a*e0
h1 = h1-a*e1
h2 = h2-a*e2
print(h0, h1, h2)
0.5556911407130427 707.2971425228636 1.5574169999734213