Courseiva

Databricks-ML-Assoc Databricks Machine Learning Practice Question

A data scientist is working in a Databricks notebook and wants to use MLflow to log a trained scikit-learn model. They want to ensure that the model can be loaded later for inference. What is the correct MLflow function to log the model?

⚠ Common exam trap

A common mix-up: candidates confuse generic artifact logging or model registration with flavor-specific model logging, which is required for proper model persistence.

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

To log a scikit-learn model, use mlflow.sklearn.log_model. This function captures the model, its dependencies, and optionally a signature, making it easy to load later with mlflow.sklearn.load_model. It is the standard way to persist scikit-learn models in MLflow, ensuring reproducibility and compatibility with model serving.

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_artifact

    Why it's wrong here

    mlflow.log_artifact logs a file or directory as an artifact, but it does not capture the model's flavor or dependencies. While you could log the pickled model file, loading it would require manual steps and would not integrate with MLflow's model loading APIs. Thus, it is not the correct function for logging a scikit-learn model in a reusable way.

  • ✓

    mlflow.sklearn.log_model

    Why this is correct

    mlflow.sklearn.log_model is the correct function to log a scikit-learn model in MLflow. It saves the model in a format that includes the model's dependencies and can be loaded later with mlflow.sklearn.load_model. This ensures the model can be used for inference. It also records the model signature and input example if provided.

  • ✗

    mlflow.log_model

    Why it's wrong here

    mlflow.log_model is a generic function that requires specifying the model flavor, such as 'sklearn'. However, it is not the recommended approach for scikit-learn models because the flavor-specific function mlflow.sklearn.log_model provides a simpler interface and handles defaults. Using the generic function without proper flavor specification may lead to errors or incomplete logging.

  • ✗

    mlflow.register_model

    Why it's wrong here

    mlflow.register_model registers an existing model URI in the MLflow Model Registry. It does not log a model from memory; it requires the model to already be logged and have a URI. Therefore, it cannot be used to log a newly trained scikit-learn model. Its purpose is model management, not initial logging.

About these practice questions

One of 319 original Databricks-ML-Assoc practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.