Skip to Content

DP-100: How to Log Dictionary Type Artifacts in Azure ML with MLflow?

Learn the correct syntax for logging dictionary type artifacts in Azure Machine Learning experiments using MLflow. Detailed explanation and rationale provided.

Table of Contents

Question

You manage an Azure Machine Learning workspace.

You experiment with an MLflow model that trains interactively by using a notebook in the workspace.

You need to log dictionary type artifacts of the experiments in Azure Machine Learning by using MLflow.

Which syntax should you use?

A. mlflow.log_input(my_dict)
B. mlflow.log_metric(“my_metric”, my_dict)
C. mlflow.log_metrics(my_dict)
D. mlflow.log_text(“my_metric”, my_dict)

Answer

D. mlflow.log_text(“my_metric”, my_dict)

Explanation

To log dictionary type artifacts of experiments in Azure Machine Learning using MLflow, the correct syntax to use is:

mlflow.log_dict(my_dict, “my_dict.json”)

In MLflow, the mlflow.log_dict() function is specifically designed for logging dictionary type objects as artifacts. It takes two arguments:

  1. The dictionary object to be logged (my_dict in this case)
  2. The artifact path where the dictionary should be saved, which should have a .json file extension (“my_dict.json” here)

When mlflow.log_dict(my_dict, “my_dict.json”) is called, it saves the my_dict dictionary as a JSON file artifact named “my_dict.json” in the MLflow tracking server. This allows the dictionary artifact to be tracked and versioned as part of the experiment run.

The other options provided are incorrect for the given use case:

  • mlflow.log_input() is not a valid MLflow function.
  • mlflow.log_metric() is for logging scalar metrics, not dictionaries.
  • mlflow.log_metrics() is for logging multiple scalar metrics at once, not dictionaries.
  • mlflow.log_text() is for logging text as an artifact, but it doesn’t save it in JSON format suitable for dictionaries.

Therefore, mlflow.log_dict(my_dict, “my_dict.json”) is the appropriate syntax for logging a dictionary artifact in an Azure ML experiment using MLflow.

Microsoft DP-100 certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the Microsoft DP-100 exam and earn Microsoft DP-100 certification.