Error in MSE in ex M4.02

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?

Yes, your function is the equivalent. You could use the Python operator

np.mean((y_true - y_pred) ** 2)

I solved the issue in FIX wrong intercept value in solution · INRIA/scikit-learn-mooc@1fd09a1 · GitHub

One can synchronize the notebook to see the correct solution.

Thanks for reporting.