Question 39
Domain 5: Monitor, retrain, and manage ML lifecycleYou are trying to log multiple metrics from a model evaluation loop using MLflow in Azure ML SDK v2. Which approach is correct?
Correct answer: A
Explanation
MLflow’s `log_metrics` API is designed to record multiple metrics in one call by passing a dictionary of metric names and values, such as `{'accuracy': 0.92, 'precision': 0.88}`. This matches the need to log multiple evaluation results from a model loop in Azure ML SDK v2.
Why each option is right or wrong
A. Use mlflow.log_metrics({'accuracy': 0.92, 'precision': 0.88})
MLflow’s Python API includes `mlflow.log_metrics(metrics, step=None, synchronous=None)`, which accepts a single dictionary mapping metric names to numeric values, so one call can record both evaluation outputs together. In Azure ML SDK v2, the MLflow tracking integration uses the same API, and the values must be scalar numbers such as `0.92` and `0.88`, not separate logging calls for each metric.
B. Use mlflow.set_tags()
C. Use mlflow.save_metrics()
D. Use mlflow.log_param()