QuestionQ122

VerifiedModel Development

A data scientist has built a linear regression model with Spark ML and generated predictions in a Spark DataFrame, preds_df, with this schema:

prediction DOUBLE actual DOUBLE

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

Explanation

Spark ML's RegressionEvaluator is designed for regression predictions and supports rmse as a metric. Configuring it with predictionCol="prediction", labelCol="actual", and metricName="rmse", then calling evaluate(preds_df), returns the root mean-squared error as a scalar value.

Learn more

Community Discussion

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