Mean Squared error in Python
You are modifying the index for no reason. A for loop increments it anyways. Also, you are not using the index, for example, you are not using any y[i] - y_pred[i]
, hence you don't need the loop at all.
Use the arrays
mse = np.mean((y - y_pred)**2)