Databricks-ML-Pro Model Development Practice Question
A data scientist is using MLflow to track a training run. They want to log a dictionary of hyperparameters and a list of evaluation metrics that are computed at the end of each epoch. Which MLflow API calls should they use to log these items?
⚠ Common exam trap
The trap here is thinking that logging hyperparameters as tags or artifacts is sufficient, when in fact MLflow treats parameters, metrics, and tags separately, and only parameters and metrics are comparable in the UI's main views.
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_params()` for the hyperparameters and `mlflow.log_metrics()` for the metrics, calling the latter once per epoch with the epoch number as the step.
The correct approach is to use `mlflow.log_params()` for the hyperparameter dictionary and `mlflow.log_metrics()` for the metrics dictionary, specifying the epoch as the step. This leverages MLflow's batch logging APIs and ensures that metrics are recorded as time-series data, which the UI can plot over steps. It also keeps parameters organized in the parameters section.
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.log_param()` for each hyperparameter individually and `mlflow.log_metric()` for each metric, calling the latter once per epoch with the epoch number as the step.
Why it's wrong here
While `mlflow.log_param()` and `mlflow.log_metric()` can log individual items, using them in a loop is less efficient and more verbose than the batch methods. The batch methods `log_params()` and `log_metrics()` are designed for dictionaries and are preferred for logging multiple values at once. This approach would work but is not the most concise or efficient.
- ✗
Use `mlflow.log_artifact()` to log a JSON file containing the hyperparameters and metrics, and then parse it in the MLflow UI.
Why it's wrong here
Logging a JSON artifact makes the data available as a file, but it does not integrate with the MLflow UI's metrics and parameters comparison views. The UI cannot automatically parse and plot metrics from an arbitrary JSON artifact. This approach would hinder experiment comparison and is not recommended for tracking parameters and metrics.
- ✓
Use `mlflow.log_params()` for the hyperparameters and `mlflow.log_metrics()` for the metrics, calling the latter once per epoch with the epoch number as the step.
Why this is correct
`mlflow.log_params()` accepts a dictionary of parameters and logs them as key-value pairs. `mlflow.log_metrics()` accepts a dictionary of metric names to values and an optional `step` argument to record metrics at different points, such as epochs. This is the standard way to log per-epoch metrics for time-series visualization in the MLflow UI.
- ✗
Use `mlflow.set_tag()` to log the hyperparameters and `mlflow.log_metric()` for the metrics, calling the latter once per epoch with the epoch number as the step.
Why it's wrong here
Tags are meant for metadata and are not displayed in the parameters section of the MLflow UI. Using tags for hyperparameters would make them less discoverable and not comparable as parameters. Metrics logged with `log_metric()` would work, but the hyperparameters would not be properly tracked as parameters.
About these practice questions
One of 300 original Databricks-ML-Pro 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-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.