Which evaluator scores a Spark ML binary classifier by area under the ROC curve?
- Exam domain
- Model Development44% of the exam
- Difficulty
- Easy
- 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: Evaluate a SparkML model.
Evaluating a Spark ML model is named.
Why B is the answer
BinaryClassificationEvaluator(metricName="areaUnderROC")
BinaryClassificationEvaluator supports areaUnderROC and areaUnderPR. RegressionEvaluator covers rmse, mae and r2.
Remember: Match evaluator to problem type.
How it works
MLlib evaluators are per problem type.
In detail
- Binary: BinaryClassificationEvaluator.
- Regression: RegressionEvaluator.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. RegressionEvaluator(metricName="areaUnderROC"), which handles every model typeWrongMost tempting
RegressionEvaluator has no ROC metric.
Why it tempts: Metric names look interchangeable.
B. BinaryClassificationEvaluator(metricName="areaUnderROC")Right
Match evaluator to problem type.
C. ClusteringEvaluatorWrong
ClusteringEvaluator is for clusters.
D. VectorAssemblerWrong
VectorAssembler is not an evaluator.
Use case
An illustrative scenario, not a real incident.
Illustrative: a fraud model reports areaUnderPR alongside ROC because fraud is rare.
See it in different ways
flowchart TD
Q{"Problem type?"}
Q -->|"Binary"| A0["BinaryClassificationEvaluator"]
Q -->|"Multiclass"| A1["MulticlassClassificationEvaluator"]
Q -->|"Regression"| A2["RegressionEvaluator"]How to read this chart
- At "Problem type?": if "Binary", go to "BinaryClassificationEvaluator"; if "Multiclass", go to "MulticlassClassificationEvaluator"; if "Regression", go to "RegressionEvaluator".
flowchart LR S0["transform test"] --> S1["Evaluator"] --> S2["evaluate"] --> S3["Log metric"]
How to read this chart
- Read it in order: transform test, then Evaluator, then evaluate, then Log metric.