Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Databricks Machine Learning Associate Exam - Topic 4 Question 47 Discussion

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 DOUBLEactual DOUBLEWhich 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)E)
C) Option C
A) Option A
B) Option B
D) Option D
E) Option E

Databricks Machine Learning Associate Exam - Topic 4 Question 47 Discussion

Actual exam question for Databricks's Databricks Machine Learning Associate exam
Question #: 47
Topic #: 4
[All Databricks Machine Learning Associate Questions]

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)

E)

Show Suggested Answer Hide Answer
Suggested Answer: C

The code block to compute the root mean-squared error (RMSE) for a linear regression model in Spark ML should use the RegressionEvaluator class with metricName set to 'rmse'. Given the schema of preds_df with columns prediction and actual, the correct evaluator setup will specify predictionCol='prediction' and labelCol='actual'. Thus, the appropriate code block (Option C in your list) that uses RegressionEvaluator to compute the RMSE is the correct choice. This setup correctly measures the performance of the regression model using the predictions and actual outcomes from the DataFrame. Reference:

Spark ML documentation (Using RegressionEvaluator to Compute RMSE).


Contribute your Thoughts:

0/2000 characters
Cheryl
3 days ago
Surprised there's no mention of using a built-in function!
upvoted 0 times
...
Christa
8 days ago
Totally agree with B, it's straightforward!
upvoted 0 times
...
Kasandra
14 days ago
Wait, isn't Option C missing something?
upvoted 0 times
...
Ettie
19 days ago
I think Option D is the right choice!
upvoted 0 times
...
Britt
24 days ago
Option B looks solid for RMSE calculation.
upvoted 0 times
...
Brandee
29 days ago
I think option E looks familiar, but I’m uncertain if it correctly assigns the RMSE to the variable.
upvoted 0 times
...
Sue
1 month ago
I feel like we did a similar question where we had to compute metrics from a DataFrame, but I can't remember the exact syntax.
upvoted 0 times
...
Lauran
1 month ago
I think it was something about using the `RegressionEvaluator`, but I can't recall if it was in option C or D.
upvoted 0 times
...
Jaime
1 month ago
I remember we practiced calculating RMSE, but I’m not sure which code block uses the right functions in Spark.
upvoted 0 times
...

Save Cancel