Databricks Machine Learning Associate exam dumps

Databricks Machine Learning Associate practice question 123 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 123

Single answer

You have trained a machine learning model in Databricks and logged its artifacts using MLflow. Now, you want to register this model to the MLflow Model Registry programmatically using the MLflow Client API. Which of the following code snippets correctly demonstrates how to register the model?

  1. A

    from mlflow.tracking import MlflowClient client = MlflowClient() model_uri = 'runs://model' client.create_registered_model(name='my_model', source=model_uri)

  2. B

    from mlflow.tracking import MlflowClient client = MlflowClient() model_uri = 'runs://model' client.register_model(model_uri, 'my_model')

  3. C

    from mlflow import mlflow_client client = mlflow_client() model_uri = 'runs://model' client.create_registered_model(model_uri, 'my_model')

  4. D

    from mlflow.tracking import MlflowClient client = MlflowClient() model_uri = 'models://' client.register_model(model_uri, 'my_model')

Show answer and explanation

Correct answer: B

Explanation

The correct way to programmatically register a model using the MLflow Client API is by using the register_model method of the MlflowClient class. This method takes the model artifact URI (e.g., 'runs://model') and the desired registered model name as inputs. The other options either use incorrect functions, incorrect parameters, or reference non-existent methods.

  • A. Incorrect.

    This code is incorrect because the create_registered_model function is used to create a new registered model name, but it does not register a specific model version or artifact.

  • B. Correct.

    This is the correct code snippet. The register_model function of MlflowClient is used to register a model artifact (specified by its URI) under a given model name in the MLflow Model Registry.

  • C. Incorrect.

    This code is incorrect because the mlflow_client() function does not exist. The correct function to use is MlflowClient() from the mlflow.tracking module.

  • D. Incorrect.

    This code is incorrect because the register_model function expects a model artifact URI (e.g., 'runs://model') and a model name, not a URI from the Model Registry (e.g., 'models://').

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