Scaling features is one of the easiest places to leak information into a model. If you compute the mean and standard deviation over the full dataset before splitting, the test set has already shaped the training features. The fix is to learn the scaling statistics from the training rows only, then apply those same numbers to the test rows, even when the test rows look different.
Implement standard_scale_no_leakage(X_train, X_test), which returns (scaled_train, scaled_test). Both are scaled with the per-column mean and standard deviation computed from X_train alone.
1, so it becomes all zeros.Open one at a time. Each gives away a little more than the last.
Compute mean and std from X_train only, with axis=0. Apply those same two arrays to both matrices.
Replace zero standard deviations with 1.0 using np.where before dividing.
No results yet
Run your code to check it against the examples, or submit to run every test.