A data scientist has developed a linear regression model using Spark ML and computed the predictions in a Spark DataFrame preds_df with the following schema:
prediction DOUBLE
actual DOUBLE
Which of the following code blocks can be used to compute the root mean-squared-error of the model according to the data in preds_df and assign it to the rmse variable?
A)

B)

C)

D)

To compute the root mean-squared-error (RMSE) of a linear regression model using Spark ML, the RegressionEvaluator class is used. The RegressionEvaluator is specifically designed for regression tasks and can calculate various metrics, including RMSE, based on the columns containing predictions and actual values.
The correct code block to compute RMSE from the preds_df DataFrame is:
regression_evaluator = RegressionEvaluator( predictionCol='prediction', labelCol='actual', metricName='rmse' ) rmse = regression_evaluator.evaluate(preds_df)
This code creates an instance of RegressionEvaluator, specifying the prediction and label columns, as well as the metric to be computed ('rmse'). It then evaluates the predictions in preds_df and assigns the resulting RMSE value to the rmse variable.
Options A and B incorrectly use BinaryClassificationEvaluator, which is not suitable for regression tasks. Option D also incorrectly uses BinaryClassificationEvaluator.
Blythe
3 months agoBarabara
3 months agoTenesha
3 months agoGlory
4 months agoLuis
4 months agoJamal
4 months agoLaura
4 months agoWilliam
4 months agoPilar
5 months agoKaron
5 months agoAileen
5 months agoVicky
5 months agoHyman
5 months agoLoise
5 months agoTheodora
5 months agoLisha
5 months agoRashida
2 years agoMike
2 years agoGail
2 years agoMarkus
2 years agoLuke
2 years agoLinette
2 years agoSvetlana
2 years agoRonnie
2 years agoLynda
2 years agoBecky
2 years agoTemeka
2 years agoSlyvia
2 years agoLilli
2 years agoAngella
2 years agoKaran
2 years agoLeigha
2 years agoValentin
2 years agoLaquanda
2 years agoUla
2 years agoSabina
2 years ago