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 Exam Databricks Machine Learning Associate Topic 3 Question 24 Discussion

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

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?

Show Suggested Answer Hide Answer
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

Contribute your Thoughts:

Tommy
2 days ago
Definitely not B, that syntax is off.
upvoted 0 times
...
Sylvia
8 days ago
I think option A looks correct!
upvoted 0 times
...
Corrina
13 days ago
I think option C has a typo with "millow" instead of "mlflow," so that one can't be right.
upvoted 0 times
...
Reta
19 days 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.
upvoted 0 times
...
Kathryn
24 days 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.
upvoted 0 times
...
Shawna
1 month 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.
upvoted 0 times
...
Dianne
1 month 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.
upvoted 0 times
...
Glen
1 month 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.
upvoted 0 times
...
Kris
1 month 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.
upvoted 0 times
...
Xuan
1 month 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.
upvoted 0 times
...
Mollie
6 months 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.
upvoted 0 times
...
Kristine
6 months ago
D doesn't seem right. The question says the logged model name is 'model', not 'best_model'.
upvoted 0 times
Verlene
4 months ago
I agree, option D is incorrect. The model name should be 'model', not 'best_model'.
upvoted 0 times
...
Alpha
4 months ago
C) millow.register_model(f\'runs:/{run_id)/model\')
upvoted 0 times
...
Josue
5 months ago
B) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
upvoted 0 times
...
Oretha
5 months ago
A) mlflow.register_model(run_id, \'best_model\')
upvoted 0 times
...
...
Essie
6 months ago
Hmm, I'm not sure about this one. C looks like it might be missing a closing quote in the registration path.
upvoted 0 times
Dan
5 months ago
C) millow.register_model(f\'runs:/{run_id)/model\')
upvoted 0 times
...
Omer
5 months ago
B) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
upvoted 0 times
...
Karina
5 months ago
A) mlflow.register_model(run_id, \'best_model\')
upvoted 0 times
...
...
Phuong
6 months 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.
upvoted 0 times
Amber
5 months ago
D) mlflow.register_model(f\'runs:/{run_id}/best_model\', \'model\')
upvoted 0 times
...
Micah
6 months ago
That makes sense, using the run_id and model name directly in the registration path.
upvoted 0 times
...
Mabel
6 months ago
A) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
upvoted 0 times
...
...
Erinn
6 months 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.
upvoted 0 times
Trinidad
6 months ago
C) millow.register_model(f\'runs:/{run_id)/model\')
upvoted 0 times
...
Kimbery
6 months ago
B) mlflow.register_model(f\'runs:/{run_id}/model'', \'best_model'')
upvoted 0 times
...
Karma
6 months ago
A) mlflow.register_model(run_id, \'best_model\')
upvoted 0 times
...
...
Serita
7 months ago
I'm not sure, but I think B could be the right choice.
upvoted 0 times
...
Valentin
7 months ago
I believe it's actually D.
upvoted 0 times
...
Novella
7 months ago
I think the correct answer is A.
upvoted 0 times
...

Save Cancel