QuestionQ97

VerifiedModel Development

A data scientist has created a linear regression model using Spark ML and generated predictions in a Spark DataFrame, preds_df, with the following schema:

prediction DOUBLE actual DOUBLE

Which of the following code blocks can compute the model’s root mean-squared error using the data in preds_df and assign it to the rmse variable?

Explanation

Computing RMSE for a Spark ML regression model requires a RegressionEvaluator constructed with predictionCol="prediction", labelCol="actual", and metricName="rmse", followed by a call to its evaluate method on the predictions DataFrame — evaluate is what actually computes and returns the numeric metric assigned to rmse. Merely constructing an evaluator yields an evaluator object, not a metric value. BinaryClassificationEvaluator supports classification metrics such as areaUnderROC and cannot compute RMSE, and Summarizer only produces column summary statistics.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!