Databricks Machine Learning Professional Question 50
Select 2You are training a machine learning model on Databricks and want to log and analyze SHAP plots to interpret model predictions. Additionally, you need to log a custom visualization and metadata about the model's hyperparameters to keep track of the experiment details. Which of the following actions will correctly achieve this functionality?
- A
Use the
mlflow.log_artifact()method to log the SHAP plot image and custom visualization files. - B
Use the
mlflow.log_metrics()method to log the SHAP plot and custom visualizations. - C
Use the
mlflow.log_dict()method to log a dictionary containing metadata like hyperparameters. - D
Store SHAP plots and custom visualizations in a local file system and manually upload them to the Databricks workspace.
- E
Use the
mlflow.log_artifact()method to log the SHAP plot, custom visualizations, and metadata.
Show answer and explanation
Correct answers: A, C
Explanation
To log and analyze SHAP plots and custom visualizations in Databricks, you should use the mlflow.log_artifact() method, which is designed for logging files. To track metadata such as hyperparameters, the mlflow.log_dict() method is appropriate. These methods allow seamless integration with MLflow's experiment tracking UI, making them more efficient and scalable than manual approaches.
- A. Correct.
Correct. The
mlflow.log_artifact()method is used to log files like SHAP plot images and custom visualizations. These files can then be visualized and accessed in the MLflow UI. - B. Incorrect.
Incorrect. The
mlflow.log_metrics()method is used for logging numerical metrics (e.g., accuracy or loss) and is not suitable for logging artifacts like SHAP plots or custom visualizations. - C. Correct.
Correct. The
mlflow.log_dict()method allows you to log metadata, such as hyperparameters, as a dictionary. This is particularly useful for storing additional context about the experiment. - D. Incorrect.
Incorrect. While storing files locally and manually uploading them is possible, it is not an efficient or scalable approach. Using MLflow's logging methods directly is the recommended practice.
- E. Incorrect.
Incorrect. The
mlflow.log_artifact()method is meant for logging files, not metadata. Metadata should be logged using methods likemlflow.log_dict().