Transaction amounts are heavily right-skewed. Which transformation often helps a linear model?
- Exam domain
- Data Manipulation and Preparation23% of the exam
- Difficulty
- Medium
- In this mock
- 11 questions on this domainPractise this domain
Why the exam asks this
Data Manipulation and Preparation (23% of the exam)
Objective in the exam guide: Feature engineering for numerical and categorical variables
Numeric feature engineering is part of the objective.
Why B is the answer
Apply a log transform
A log transform compresses large values and makes skewed distributions closer to normal, which helps linear models.
Remember: Log transform skewed numeric features.
How it works
Skewed numeric features are often log-transformed or binned before modelling.
In detail
- Log transforms reduce skew.
- Use log1p when zeros exist.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Sort the column alphabeticallyWrong
Sorting does not change values.
B. Apply a log transformRight
Log transform skewed numeric features.
C. Multiply every value by 1,000 so small amounts become large enough to matterWrongMost tempting
Scaling by a constant keeps the skew.
Why it tempts: Making numbers bigger sounds like it adds weight.
D. Replace every amount with the overall mean valueWrong
Replacing with the mean destroys information.
Use case
An illustrative scenario, not a real incident.
Illustrative: log1p on amounts lowers a linear model's error by 12%.
See it in different ways
stateDiagram-v2 state "Skewed amounts" as s0 state "Log transformed" as s1 state "Better fit" as s2 [*] --> s0 s0 --> s1: apply log1p s1 --> s2: retrain s2 --> [*]
How to read this chart
- It starts at "Skewed amounts".
- From "Skewed amounts", "apply log1p" moves it to "Log transformed".
- From "Log transformed", "retrain" moves it to "Better fit".
- It ends at "Better fit".
flowchart LR S0["Check distribution"] --> S1["Handle outliers"] --> S2["Transform"] --> S3["Scale"]
How to read this chart
- Read it in order: Check distribution, then Handle outliers, then Transform, then Scale.