AI-300 practice question 2 of 15

You create an Azure Machine Learning workspace. You must use the Python SDK v2 to implement an experiment from a Jupyter notebook in the workspace. The experiment must log a list of numerical metrics. You need to implement a method to log a list of numerical metrics. Which method should you use?

Full set: 60 questions
Answer options
A: mlflow.log_batch() Correct answer
B: mlflow.log_metric()
C: mlflow.log_artifact()
D: mlflow.log_image()
Correct Answer:
A. mlflow.log_batch()
Explanation

For Azure Machine Learning SDK v2, Microsoft recommends MLflow Tracking for experiment logging. When a requirement specifically calls for logging a list of numerical metric values, the appropriate operation is log_batch(). Microsoft provides an explicit SDK v2 migration example in which a list of numeric values is converted into MLflow Metric objects and submitted through MlflowClient().log_batch(). Technically, the concrete Python implementation uses the tracking client: MlflowClient().log_batch(run_id, metrics=metrics) where metrics contains a sequence of Metric objects representing the numerical values. Microsoft likewise documents batch metric logging as preferable when multiple metrics or multiple values of the same metric need to be recorded efficiently. mlflow.log_metric() records an individual numeric metric value. It can be invoked repeatedly, but Microsoft specifically demonstrates log_batch() for a curve or list of numeric values. mlflow.log_artifact() stores files and other artifacts rather than numerical tracking metrics, while mlflow.log_image() is intended for images and therefore does not satisfy the requirement. Therefore, A is the intended answer. In actual Python SDK v2 code, this operation is normally invoked as MlflowClient().log_batch(). Study Guide Reference: Implement machine learning model lifecycle and operations --- Azure Machine Learning experiments, MLflow tracking, metric logging, experiment observability, and SDK v2 migration.

Scroll to Top