1.14 Register a model using the MLflow Client API in the Unity Catalog registry
1.Which MLflow Client API function is used to register a new model version to a three-level namespace in Unity Catalog?
- A.mlflow.create_registered_model()
- B.mlflow.register_model()
- C.mlflow.unity_catalog.create_model()
- D.mlflow.log_model()
Show answer & explanation
Correct answer: B — mlflow.register_model()
- A. Incorrect. The `mlflow.create_registered_model()` function is used to create a new registered model *name* in the registry. It does not register a specific model *version* from a run, which is what the question asks for. The primary function for registering a version is `mlflow.register_model()`.
- B. Correct. `mlflow.register_model()` is the function used to create a new model version in the registry from a logged model artifact. It takes a `model_uri` (e.g., `runs:/<run_id>/<artifact_path>`) and a `name`. When using Unity Catalog, this `name` argument accepts the three-level namespace format (`catalog.schema.model`). If the model name does not already exist, this function will create it before creating the new version.
- C. Incorrect. This is not a valid function in the MLflow Client API. Unity Catalog integration is handled through standard MLflow functions by setting the registry URI to `databricks-uc` and using the three-level namespace in function arguments.
- D. Incorrect. `mlflow.log_model()` saves a model as an artifact within an MLflow run. While this is a necessary prerequisite for registration, this function itself does not interact with the model registry or create a model version. The resulting `model_uri` from this step is passed to `mlflow.register_model()` to perform the registration.