import numpy as np
# A small dataset. A pattern to discover.
x = np.array([1., 2., 3., 4.])
y = 2 * x + 1
w, b = 0., 0.
for step in range(200):
error = (w * x + b) - y
w -= 0.05 * (2 * error * x).mean()
b -= 0.05 * (2 * error).mean()
print(f"w={w:.3f}, b={b:.3f}")