You need to scale numeric features to unit variance before a linear model in Spark ML. Which component and type is it?
- Exam domain
- Model Development44% of the exam
- Difficulty
- Medium
- In this mock
- 22 questions on this domainPractise this domain
Why the exam asks this
Model Development (44% of the exam)
Objective in the exam guide: Apply the appropriate estimator and/or transformer given a use case.
Choosing estimators and transformers is named.
Why C is the answer
StandardScaler, an estimator that learns the statistics
StandardScaler must learn statistics from data, so it is an estimator whose fitted model transforms features.
Remember: StandardScaler is an estimator.
How it works
Components that learn statistics are estimators.
In detail
- Learns statistics: estimator.
- Fitted result: transformer.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Bucketizer, which learns varianceWrong
Bucketizer splits by fixed thresholds.
B. Tokenizer, a transformer for numbersWrong
Tokenizer splits text.
C. StandardScaler, an estimator that learns the statisticsRight
StandardScaler is an estimator.
D. VectorAssembler, an estimator that learns scaling factors from the dataWrongMost tempting
VectorAssembler only combines columns, with nothing to learn.
Why it tempts: VectorAssembler is always in pipelines, but learns nothing.
Use case
An illustrative scenario, not a real incident.
Illustrative: scaled features let regularization treat income and age fairly.
See it in different ways
stateDiagram-v2 state "Estimator" as s0 state "StandardScalerModel" as s1 state "Scaled features" as s2 [*] --> s0 s0 --> s1: fit on train s1 --> s2: transform s2 --> [*]
How to read this chart
- It starts at "Estimator".
- From "Estimator", "fit on train" moves it to "StandardScalerModel".
- From "StandardScalerModel", "transform" moves it to "Scaled features".
- It ends at "Scaled features".
flowchart TD
Q{"Does it learn from data?"}
Q -->|"Yes"| A0["Estimator"]
Q -->|"No"| A1["Transformer"]How to read this chart
- At "Does it learn from data?": if "Yes", go to "Estimator"; if "No", go to "Transformer".