Which practice most directly helps prevent data leakage when creating train/validation splits?
Answer
Randomly shuffle and split before performing scaling/encoding, then fit only on training data
Explanation
Fitting transformations only on the training set prevents information from leaking from validation into training. This ensures validation reflects real-world generalization.
Last reviewed: October 2026
Reviewed by FirstInTest Editorial Team
Related questions
For an imbalanced classification problem, which strategy is most likely to improve model performance without changing the evaluation metric?
View question →
A workflow uses a feature transformation step that takes raw categorical strings and outputs encoded numeric vectors. What approach best avoids training/serving skew in encoding?
View question →
Which AWS service is best suited to run large-scale hyperparameter tuning jobs for a machine learning model?
View question →
A model produces predicted probabilities for multi-class classification. Which evaluation metric is most appropriate if you need to measure the quality of ranked predictions across classes?
View question →
You need near real-time inference with variable request rates and desire automatic scaling. Which deployment option is most appropriate in SageMaker?
View question →
In a SageMaker pipeline, which component executes a step such as data preprocessing or feature engineering using a container?
View question →