Challenge - 5 Problems
MLflow Logging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this MLflow logging command?
Consider the following Python code snippet using MLflow to log parameters and metrics. What will be printed after running this code?
MLOps
import mlflow with mlflow.start_run(): mlflow.log_param("learning_rate", 0.01) mlflow.log_metric("accuracy", 0.95) print(mlflow.active_run().info.run_id)
Attempts:
2 left
💡 Hint
mlflow.start_run() creates a new run and mlflow.active_run() returns the current run info.
✗ Incorrect
The mlflow.start_run() context manager starts a new run. mlflow.active_run() returns the current run object, and its info.run_id is a unique identifier string (UUID) for the run.
🧠 Conceptual
intermediate1:30remaining
Which MLflow function logs a hyperparameter for a model training run?
You want to record the value of a hyperparameter named 'batch_size' with value 32 during your ML experiment. Which MLflow function should you use?
Attempts:
2 left
💡 Hint
Parameters are fixed values describing the run, metrics are numeric results that can change over time.
✗ Incorrect
mlflow.log_param() is used to log parameters like hyperparameters. mlflow.log_metric() is for numeric results like accuracy. mlflow.log_artifact() is for files. mlflow.set_tag() adds metadata tags.
❓ Troubleshoot
advanced2:00remaining
Why does this MLflow metric logging code fail to record the metric?
You run this code but the metric 'loss' does not appear in the MLflow UI after the run completes. What is the most likely reason?
import mlflow
mlflow.log_metric('loss', 0.25)
Attempts:
2 left
💡 Hint
MLflow needs a run context to associate logged data with.
✗ Incorrect
MLflow requires an active run context (started with mlflow.start_run()) to log parameters or metrics. Without it, the log_metric call does nothing.
🔀 Workflow
advanced1:30remaining
What is the correct sequence to log parameters and metrics in MLflow during a training run?
Arrange the steps in the correct order to log parameters and metrics properly in MLflow.
Attempts:
2 left
💡 Hint
You must start the run before logging anything.
✗ Incorrect
You first start the run, then log parameters before training, then train and compute metrics, then log metrics.
✅ Best Practice
expert2:30remaining
Which practice ensures reliable metric logging in distributed training with MLflow?
In a distributed training setup with multiple workers, which approach best ensures metrics are logged correctly without duplication or loss?
Attempts:
2 left
💡 Hint
Avoid multiple workers writing to the same run at the same time.
✗ Incorrect
In distributed training, only the main worker should log aggregated metrics to avoid duplication and conflicts. Other workers should not log metrics independently.