Courseiva

Databricks-ML-Assoc Databricks Machine Learning Practice Question

A data scientist has trained a model using scikit-learn and wants to log it to MLflow for deployment. They need to ensure that the model can be served with the correct dependencies. Which MLflow function should they use to log the model?

⚠ Common exam trap

Candidates often confuse model logging with artifact logging or model registration, which serve different purposes in the MLflow lifecycle.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

`mlflow.sklearn.log_model()`

`mlflow.sklearn.log_model()` is specifically designed to log scikit-learn models, capturing the model flavor, dependencies, and signature. This allows the model to be served or deployed with the correct environment. Other functions either log artifacts, metrics, or register an already logged model, none of which fulfill the logging requirement.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    `mlflow.log_metric()`

    Why it's wrong here

    `mlflow.log_metric()` records evaluation metrics such as accuracy or RMSE. It does not handle model serialization or dependency management. While important for tracking, it is not used for logging the model itself, so it fails to meet the requirement of deploying the model with dependencies.

  • ✓

    `mlflow.sklearn.log_model()`

    Why this is correct

    `mlflow.sklearn.log_model()` logs a scikit-learn model in MLflow's native format, capturing the model's flavor, dependencies (via conda_env or pip_requirements), and signature. This enables seamless deployment with MLflow Models, including serving and scoring. It is the correct function for logging scikit-learn models.

  • ✗

    `mlflow.register_model()`

    Why it's wrong here

    `mlflow.register_model()` registers an already logged model to the Model Registry. It does not log the model; it requires a model URI from a previous logging step. Using it without first logging the model would fail. Thus, it is not the function to log a scikit-learn model.

  • ✗

    `mlflow.log_artifact()`

    Why it's wrong here

    `mlflow.log_artifact()` logs a file or directory as an artifact but does not capture the model's flavor or dependencies. It is useful for logging additional files like plots or data, but it does not create a model that can be directly served. Using it alone would require manual specification of dependencies and loading logic.

About these practice questions

This Databricks-ML-Assoc question is part of Courseiva's 319-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Databricks exam blueprint

This Databricks-ML-Assoc practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-ML-Assoc exam.