Features range from 0 to 1 and from 0 to 1,000,000. A distance-based model such as k-nearest neighbours performs poorly. What helps?
- Exam domain
- Data Preparation17% of the exam
- Difficulty
- Medium
- In this mock
- 8 questions on this domainPractise this domain
Why the exam asks this
Data Preparation (17% of the exam)
Objective in the exam guide: Standardizing data as needed to ensure uniformity across features
Standardization appears twice in this domain.
Why D is the answer
Standardize features to a common scale fitted on training data
Distance-based models are dominated by large-range features. Standardizing to zero mean and unit variance, fitted on training data, puts features on equal footing.
Remember: Standardize features for scale-sensitive models.
How it works
Transforming and standardizing data gives features comparable scales.
In detail
- Scale features for distance-based models.
- Fit the scaler on training data.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Remove the smaller-range featureWrongMost tempting
Dropping features loses information.
Why it tempts: Dropping the odd feature seems simple.
B. Multiply all features by 1,000Wrong
Multiplying all keeps the imbalance.
C. Sort the rowsWrong
Sorting changes nothing.
D. Standardize features to a common scale fitted on training dataRight
Standardize features for scale-sensitive models.
Use case
An illustrative scenario, not a real incident.
Illustrative: standardizing lifts k-NN accuracy from 61% to 84%.
See it in different ways
flowchart LR S0["Split"] --> S1["Fit scaler on train"] --> S2["Transform train and test"] --> S3["Train model"]
How to read this chart
- Read it in order: Split, then Fit scaler on train, then Transform train and test, then Train model.
flowchart TD
Q{"Model type?"}
Q -->|"Distance or gradient based"| A0["Standardize"]
Q -->|"Tree based"| A1["Usually not needed"]How to read this chart
- At "Model type?": if "Distance or gradient based", go to "Standardize"; if "Tree based", go to "Usually not needed".