Hi so i'm writing some code for class and this for Linear Regression.
The values calculated by hand is a=1.7 and b=1.6 for the data you can see in the code.
I've tried separating different parts of the formula into different variables but the answer remains the same (1.6999999999999993).
import numpy as np
x=np.array([2,3,5,6])
y=np.array([4.5,7.2,9.2,11.5])
b=(np.sum((y-np.mean(y))*x))/(np.sum((x-np.mean(x))*x))
a=np.mean(y)-(b*(np.mean(x)))
print(a)
print(b)
The expected result is a=1.7 and b=1.6, but the output is a=1.6999999999999993.