Scaling the whole dataset before cross-validation leaks test-fold statistics into training. The fix is to fit preprocessing inside each fold.
Implement cv_mse(X, y, k): split rows into k contiguous folds (np.array_split(np.arange(n), k)); for each fold:
ddof=0, replace 0 with 1) on the training rows only and standardise both parts with themReturn the mean of the fold MSEs.