
Answer-first summary for fast verification
Answer: mlflow.log_metrics(my_dict)
The question asks for the correct syntax to log dictionary-type artifacts in MLflow. Option C (mlflow.log_metrics(my_dict)) is the correct choice because it is specifically designed to log multiple metrics from a dictionary where keys are metric names and values are metric values. This aligns with MLflow's API for batch logging metrics. Option A (mlflow.log_artifact(my_dict)) is incorrect as it logs files or directories, not dictionaries. Option B (mlflow.log_metric("my_metric", my_dict)) is invalid because it attempts to log a dictionary as a single metric value, which MLflow does not support. Option D (mlflow.log_artifacts(my_dict)) is also incorrect as it is for logging multiple files from a directory, not dictionaries. The community discussion confirms C as the correct answer with 100% consensus and upvotes, reinforcing that mlflow.log_metrics() is the proper method for dictionary input.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are working in an Azure Machine Learning workspace and training an MLflow model interactively in a notebook. You need to log dictionary-type artifacts from the experiments using MLflow.
Which syntax should you use?
A
mlflow.log_artifact(my_dict)
B
mlflow.log_metric("my_metric", my_dict)
C
mlflow.log_metrics(my_dict)
D
mlflow.log_artifacts(my_dict)
No comments yet.