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 3 Question 24 Discussion

Posted by Rex on Jan 27, 2025 at 01:06 AM

A machine learning engineer has identified the best run from an MLflow Experiment. They have stored the run ID in the run_id variable and identified the logged model name as "model". They now want to register that model in the MLflow Model Registry with the name "best_model".

Which lines of code can they use to register the model associated with run_id to the MLflow Model Registry?

Suggested Answer: C

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.


PySpark ML Documentation

Get Premium Databricks Machine Learning Associate Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
34 comments · newest first
VI
Virgina 10 months ago
Wait, are we sure about A? It seems too simple!
EL
Elly 11 months ago
D seems wrong, the model name should be 'best_model'.
IS
Isaac 11 months ago
C has a typo, should be 'mlflow' not 'millow'.
TO
Tommy 11 months ago
Definitely not B, that syntax is off.
SY
Sylvia 11 months ago
I think option A looks correct!
CO
Corrina 12 months ago
I think option C has a typo with "millow" instead of "mlflow," so that one can't be right.
RE
Reta 12 months ago
I feel like option A is too simple; it doesn't specify the model path correctly, so I doubt it's the right answer.
KA
Kathryn 12 months ago
I remember practicing a similar question where we had to format the run ID correctly, so I feel like it might be option B, but I’m a bit confused about the extra quotes.
SH
Shawna 1 year ago
I think the correct syntax for registering a model should include the run ID properly formatted, but I'm not entirely sure which option it is.
DI
Dianne 1 year ago
I'm a bit confused by the different options. The question seems straightforward, but I want to make sure I understand the correct way to use the `mlflow.register_model()` function. I think I'll jot down a quick note to review the MLflow documentation before answering this one.
GL
Glen 1 year ago
Okay, let me think this through. We have the run ID stored in the `run_id` variable, and we want to register the model with the name "best_model". I'm pretty sure option B is the way to go here, but I'll quickly skim the question again just to be sure.
KR
Kris 1 year ago
Hmm, I'm a bit unsure about this one. I know we need to use the `mlflow.register_model()` function, but I'm not 100% sure about the syntax for the model path. I'll have to double-check the documentation to make sure I get this right.
XU
Xuan 1 year ago
This looks straightforward. I think option B is the correct answer since it uses the correct format for the model path and the desired model name.
MO
Mollie 1 year ago
I'm going with B. It's the only one that matches the information provided in the question. Plus, it has a nice 'run:/' prefix, which sounds like it might be the right format for MLflow.
KR
Kristine 1 year ago
D doesn't seem right. The question says the logged model name is 'model', not 'best_model'.
VE
Verlene 1 year ago
↳ replying to Kristine
I agree, option D is incorrect. The model name should be 'model', not 'best_model'.
AL
Alpha 1 year ago
↳ replying to Kristine
C) millow.register_model(f\'runs:/{run_id)/model\')
JO
Josue 1 year ago
↳ replying to Kristine
B) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
OR
Oretha 1 year ago
↳ replying to Kristine
A) mlflow.register_model(run_id, \'best_model\')
ES
Essie 1 year ago
Hmm, I'm not sure about this one. C looks like it might be missing a closing quote in the registration path.
DA
Dan 1 year ago
↳ replying to Essie
C) millow.register_model(f\'runs:/{run_id)/model\')
OM
Omer 1 year ago
↳ replying to Essie
B) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
KA
Karina 1 year ago
↳ replying to Essie
A) mlflow.register_model(run_id, \'best_model\')
PH
Phuong 1 year ago
Definitely B. The question clearly states that the run ID is stored in the run_id variable, and the logged model name is 'model', so we need to use that in the registration path.
AM
Amber 1 year ago
↳ replying to Phuong
D) mlflow.register_model(f\'runs:/{run_id}/best_model\', \'model\')
MI
Micah 1 year ago
↳ replying to Phuong
That makes sense, using the run_id and model name directly in the registration path.
MA
Mabel 1 year ago
↳ replying to Phuong
A) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
ER
Erinn 1 year ago
I think B is the correct answer. The run ID is stored in the variable run_id, and the logged model name is 'model', so we need to use that in the registration path.
TR
Trinidad 1 year ago
↳ replying to Erinn
C) millow.register_model(f\'runs:/{run_id)/model\')
KI
Kimbery 1 year ago
↳ replying to Erinn
B) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
KA
Karma 1 year ago
↳ replying to Erinn
A) mlflow.register_model(run_id, \'best_model\')
SE
Serita 1 year ago
I'm not sure, but I think B could be the right choice.
VA
Valentin 2 years ago
I believe it's actually D.
NO
Novella 2 years ago
I think the correct answer is A.
0/2000 characters

Save Cancel