DP-100 · Question #344
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…
The correct answer is A. mlflow.log_artifact(my_dict). To log a dictionary type artifact in Azure Machine Learning using MLflow, you should first serialize the dictionary to a file and then use the mlflow.log_artifact() function to log that file.
Question
Options
- Amlflow.log_artifact(my_dict)
- Bmlflow.log_metric("my_metric", my_dict)
- Cmlflow.log_metrics(my_dict)
- Dmlflow.log_artifacts(my_dict)
How the community answered
(48 responses)- A92% (44)
- B2% (1)
- C2% (1)
- D4% (2)
Why each option
To log a dictionary type artifact in Azure Machine Learning using MLflow, you should first serialize the dictionary to a file and then use the `mlflow.log_artifact()` function to log that file.
The `mlflow.log_artifact()` method logs a local file or directory as an artifact. To log a dictionary, it must first be saved to a file (e.g., JSON, YAML), and then the path to that file is passed to `mlflow.log_artifact()` for tracking.
`mlflow.log_metric()` is used to log a single numeric metric, not a dictionary or other complex data types as artifacts.
`mlflow.log_metrics()` is used to log a dictionary of key-value pair metrics where values are numeric, not to log a dictionary itself as an artifact.
`mlflow.log_artifacts()` is used to log multiple artifacts from a specified directory, not to log a dictionary object directly.
Concept tested: MLflow logging artifacts
Source: https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.log_artifact
Topics
Community Discussion
No community discussion yet for this question.