Databricks-ML-Assoc Databricks Machine Learning Practice Question
A data scientist is using MLflow to track experiments on Databricks. They want to log a custom metric that is computed during model training and later compare it across runs using the MLflow UI. Which MLflow API call should they use?
⚠ Common exam trap
Many candidates confuse metrics with parameters or tags, assuming any key-value logging will work for comparison.
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.log_metric("custom_metric", value)
The data scientist needs to track a numeric value computed during training and compare it across runs. MLflow provides specific APIs for different types of data: parameters for inputs, metrics for numeric outputs, tags for metadata, and artifacts for files. Using log_metric ensures the value is stored as a metric and can be visualized and compared in the MLflow UI. The other APIs serve different purposes and would not provide the desired functionality.
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.set_tag("custom_metric", value)
Why it's wrong here
mlflow.set_tag attaches metadata to a run, such as the user or version. Tags are not intended for numeric metrics and cannot be plotted or compared in the same way. While they can store arbitrary strings, using them for metrics would prevent proper visualization and analysis in the MLflow UI.
- ✗
mlflow.log_artifact("custom_metric", value)
Why it's wrong here
mlflow.log_artifact logs a file or directory as an artifact, such as a model file or a plot. It is not used for scalar values like metrics. Attempting to log a metric as an artifact would require creating a file, which is inefficient and not directly comparable in the UI.
- ✗
mlflow.log_param("custom_metric", value)
Why it's wrong here
mlflow.log_param is used to log a single parameter, typically a configuration setting like learning rate or number of trees. Parameters are intended for inputs to the model, not for output metrics. Using it for a metric would misrepresent the value and make it harder to compare runs, as the UI separates parameters and metrics.
- ✓
mlflow.log_metric("custom_metric", value)
Why this is correct
mlflow.log_metric logs a numeric metric that can be tracked over time or across runs. Metrics are specifically designed for evaluation outputs such as accuracy, loss, or custom scores. This allows the MLflow UI to plot and compare the metric across runs, which is exactly what the data scientist needs for analysis.
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 →
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.