Databricks Machine Learning Associate exam dumps

Databricks Machine Learning Associate practice question 455 of 656

Databricks Certified Machine Learning Associate. Associate level, Databricks. Free question with the correct answer and a full explanation.

Databricks Machine Learning Associate Question 455

Single answer

You are working on a machine learning project and have logged multiple runs in MLflow. Each run includes metrics for accuracy, precision, and recall. You want to programmatically identify the best run based on the highest accuracy using the MLflow Client API. Which of the following code snippets correctly identifies the best run?

  1. A

    best_run = max(client.search_runs(experiment_ids=['1']), key=lambda run: run.data.metrics['accuracy'])

  2. B

    best_run = max(client.list_run_infos(experiment_ids=['1']), key=lambda run: run.data.metrics['accuracy'])

  3. C

    best_run = min(client.search_runs(experiment_ids=['1']), key=lambda run: run.data.metrics['accuracy'])

  4. D

    best_run = client.get_run(run_id='1')

Show answer and explanation

Correct answer: A

Explanation

To identify the best run programmatically using the MLflow Client API, the search_runs method is used to retrieve all runs for a given experiment. The max function is then applied with a key function that extracts the accuracy metric from each run, allowing you to find the run with the highest accuracy.

  • A. Correct.

    This is correct. The search_runs method fetches all runs from the specified experiment, and the max function is used to find the run with the highest accuracy metric.

  • B. Incorrect.

    This is incorrect because list_run_infos only retrieves metadata about runs and does not include metric data, so you cannot access run.data.metrics.

  • C. Incorrect.

    This is incorrect because min would return the run with the lowest accuracy, which does not satisfy the requirement to find the best run based on the highest accuracy.

  • D. Incorrect.

    This is incorrect because get_run retrieves a specific run by ID and does not help in programmatically identifying the best run among multiple runs.

Timed practice exam

Take a Databricks Machine Learning Associate practice test under exam conditions

48 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam