QuestionQ126
Validation TestingA Machine Learning Engineer trained a linear regression model with SparkML to predict loan-default amounts. After producing predictions on the test dataset, the engineer wants to assess the model with multiple regression metrics at the same time. The predictions DataFrame contains the columns prediction, label, and features. The engineer must calculate both RMSE and R-squared (R2) values to provide stakeholders with comprehensive model-performance results.
Which approach accomplishes this?
- A Create a RegressionEvaluator instance and set the parameter metricName to a list [‘rmse’, ‘r2’].
- B Use a single RegressionEvaluator and call evaluate() twice with different parameter maps to override the metricName for each metric.
- C Create a single RegressionEvaluator with metricName=“rmse” and use the model’s built-in summary statistics for R2.
- D Use MulticlassClassificationEvaluator with metricName set to rmse and r2 respectively.
Community Discussion