Hi,
When you show the “best” linear model you used intercept = -0.2
but when you calculated the MSE you used intercept=0.2
…
So the MSE goes from 0.615
to 0.381
Btw: when i read the exercice I thought you wanted we designed our own MSE function so I wrote :
def mse (true_values, predictions):
y_true= np.ravel(true_values)
y_pred = np.ravel(predictions)
return np.square(np.subtract(y_true,y_pred)).mean()
I suppose the function is ok since I obtained same results than with yours?