nerdexam
DatabricksDatabricks

CERTIFIED-MACHINE-LEARNING-PROFESSIONAL · Question #27

CERTIFIED-MACHINE-LEARNING-PROFESSIONAL Question #27: Real Exam Question with Answer & Explanation

The correct answer is D: mlflow.register_model(model_uri, "model"). Option D is correct because mlflow.register_model() requires two arguments: a valid MLflow model URI as the first argument and the desired registry name as the second. The model_uri variable already holds a properly formatted run URI (e.g., runs:/<run_id>/model), and pairing it w

Question

A machine learning engineer is migrating a machine learning pipeline to use Databricks Machine Learning. They have programmatically identified the best run from an MLflow Experiment and stored its URI in the model_uri variable and its Run ID in the run_id variable. They have also determined that the model was logged with the name "model". Now, the machine learning engineer wants to register that model in the MLflow Model Registry with the name "best_model". Which of the following lines of code can they use to register the model to the MLflow Model Registry?

Options

  • Amlflow.register_model(model_uri, "best_model")
  • Bmlflow.register_model(run_id, "best_model")
  • Cmlflow.register_model(f"runs:/{run_id}/best_model", "model")
  • Dmlflow.register_model(model_uri, "model")
  • Emlflow.register_model(f"runs:/{run_id}/model")

Explanation

Option D is correct because mlflow.register_model() requires two arguments: a valid MLflow model URI as the first argument and the desired registry name as the second. The model_uri variable already holds a properly formatted run URI (e.g., runs:/<run_id>/model), and pairing it with "model" - the exact artifact path name used during logging - ensures MLflow can locate and register the correct artifact.

Why the distractors fail:

  • A (model_uri, "best_model") passes a registry name that doesn't correspond to the artifact path the model was logged under; the logged artifact name is "model", not "best_model".
  • B (run_id, "best_model") passes a bare run ID string, which is not a valid MLflow URI - register_model expects a URI scheme like runs:/ or models:/.
  • C (f"runs:/{run_id}/best_model", "model") constructs a URI pointing to artifact path "best_model", but the model was logged as "model", so this URI resolves to a nonexistent artifact.
  • E (f"runs:/{run_id}/model") is missing the required second argument entirely - register_model always needs both the URI and the registry name.

Memory tip: Think of register_model(where_it_lives, what_to_call_it) - the first argument must be a proper MLflow URI (not a raw run ID), and the artifact path in that URI must match exactly how the model was logged.

Community Discussion

No community discussion yet for this question.

Full CERTIFIED-MACHINE-LEARNING-PROFESSIONAL PracticeBrowse All CERTIFIED-MACHINE-LEARNING-PROFESSIONAL Questions