Data Preparation for Machine Learnings
Data preparation is turning raw records into model-ready features: cleaning errors, imputing missing values, treating outliers, encoding categories, scaling and creating new features. It also means preventing data leakage. This unit belongs to the Data and Feature Engineering stage, where most real gains in model quality come from.
Stage: Data and Feature Engineering · Part of the Machine Learning roadmap · Last reviewed 19 November 2026
What to learn in Data Preparation
- Detect and impute missing values using median, mode or model-based methods
- Encode categorical columns with one-hot or ordinal encoding
- Scale features with standardisation or min-max scaling and know which models need it
- Create date, ratio and aggregate features from raw columns
- Identify and prevent leakage by fitting transformers only on training data
Data Preparation interview questions
What is data leakage in machine learning?
Leakage is when information from outside the training data, such as the target or future values, sneaks into features or preprocessing. The model looks excellent in testing but fails in production. Fitting scalers on the whole dataset before splitting is a common cause.
How do you handle missing values?
First understand why they are missing. Options include dropping rows or columns, imputing with mean, median or mode, or modelling the value. Adding an indicator column for missingness can help, and the imputer must be fitted on training data only.
Where Data Preparation fits in the Machine Learning roadmap
Data Preparation belongs to the Data and Feature Engineering stage (beginner level), which takes about 4 hours. Where models are won.
Other units in this stage
Back to the full Machine Learning roadmap