medium10 pts · first answer countsdata-leakagescikit-learn
Scaling before splitting
What is wrong with this preprocessing code?
from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split X_scaled = StandardScaler().fit_transform(X) X_train, X_test, y_train, y_test = train_test_split(X_scaled, y, test_size=0.2)
Discussion 0
Join free to post in the discussion.
Related questions
- Spot the bug in training codeMachine Learning Engineer
- How KNNImputer fills a gapMachine Learning Engineer
- Target encoding without leakageMachine Learning Engineer
- Several scans per patientMachine Learning Engineer
- Preprocessing inside a pipelineMachine Learning Engineer
- Training on data that never fits in RAMMachine Learning Engineer
- Test accuracy that is too highMachine Learning Engineer
- Negative scores from cross_val_scoreMachine Learning Engineer