Databricks Machine Learning Associate Question 97
Single answerYou are working on a machine learning project in Databricks and have logged multiple runs using MLflow. You want to programmatically identify the best run based on the lowest validation loss. Which approach using the MLflow Client API is correct?
- A
Use the
search_runsmethod of the MLflow Client API and sort the results by the validation loss metric. - B
Use the
get_best_runmethod of the MLflow Client API by providing the metric name. - C
Use the
get_runmethod of the MLflow Client API to retrieve all runs and manually filter for the best run. - D
Use the
log_best_runmethod of the MLflow Client API to automatically log and retrieve the best run.
Show answer and explanation
Correct answer: A
Explanation
The search_runs method of the MLflow Client API is the best approach for identifying the best run programmatically. It allows you to query runs based on specific criteria and sort them by metrics such as validation loss. This avoids manual filtering and ensures scalability in projects with multiple runs.
- A. Correct.
This is correct. The
search_runsmethod allows you to retrieve runs based on specific criteria and sort them by a metric such as validation loss. This is the recommended approach to identify the best run programmatically. - B. Incorrect.
This is incorrect. The
get_best_runmethod does not exist in the MLflow Client API. - C. Incorrect.
This is incorrect. While you can retrieve all runs using
get_run, filtering and sorting them manually is inefficient compared to usingsearch_runs. - D. Incorrect.
This is incorrect. The
log_best_runmethod does not exist in the MLflow Client API.