Databricks-ML-Pro Model Development Practice Question
A data scientist is using MLflow to track a deep learning experiment on Databricks. They want to log custom metrics that are computed during training but not automatically captured by `mlflow.autolog()`. What is the correct way to log these custom metrics?
⚠ Common exam trap
Test-takers frequently confuse the different logging functions; metrics must be logged with `log_metric` to be properly tracked and visualized.
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
✓
Use `mlflow.log_metric` within the training loop.
The correct method is to use `mlflow.log_metric` within the training loop. This function is designed for logging metrics and supports step-wise logging, which is ideal for tracking custom metrics over epochs. It integrates with MLflow's UI for visualization and comparison.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use `mlflow.set_tag` to record the metric values.
Why it's wrong here
Tags are meant for metadata and annotations, not for numerical metrics. Using tags for metrics would not allow MLflow to plot or compare them effectively. Tags are strings, so numerical values would lose their type and be less useful for analysis.
- ✗
Use `mlflow.log_param` to log the metric values.
Why it's wrong here
`mlflow.log_param` is intended for logging parameters, not metrics. Parameters are typically single values set before training, while metrics are time-series data that can change over epochs. Using log_param would incorrectly store metrics as parameters, losing their temporal nature.
- ✓
Use `mlflow.log_metric` within the training loop.
Why this is correct
`mlflow.log_metric` allows logging custom metrics at any point during training. By calling it within the training loop, the data scientist can record metrics such as custom loss functions or evaluation scores that autolog does not capture. This provides flexibility and ensures all relevant metrics are tracked.
- ✗
Use `mlflow.log_artifact` to save a file containing the metrics.
Why it's wrong here
Logging metrics as an artifact saves them as a file, but it does not integrate with MLflow's metric tracking UI, making comparison across runs difficult. Artifacts are better for larger files like models or plots, not for scalar metrics that benefit from structured logging.
About these practice questions
This Databricks-ML-Pro question is part of Courseiva's 300-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 →
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-Pro 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-Pro exam.