import numpy as np
import random
a = 0.01
b0 = random.random()
b1 = random.random()
b2 = random.random()
x = np.array([[2104, 3,400],
[1600, 3,330],
[2400, 3,369],
[1416, 2,232],
[3000, 4,540]])
E = 10e-4
e0 = 1
e1 = 1
e2 = 1
b0 = 0
b1 = 0
b2 = 0
while e0 >= E or e1 >= E or e2 >= E:
j = random.randint(0, 4)
h = b0 + b1 * x[j][0] + b2 * x[j][1]
e0 = (h - x[j][2])
e1 = (h - x[j][2]) * x[j][0]
e2 = (h - x[j][2]) * x[j][1]
b0 = b0 - a * e0
b1 = b1 - a * e1
b2 = b2 - a * e2
print(b0, b1, b2)
2.32 3285.12 4.64