Databricks Machine Learning Professional Question 51
Select 4You are implementing a machine learning model using Databricks and want to log custom SHAP plots, feature importance visualizations, and metadata for later analysis. Which of the following approaches can you use to log and view these artifacts effectively in MLflow?
- A
Use
mlflow.log_artifact()to log the SHAP plot as an image file and view it in the MLflow UI. - B
Use
mlflow.log_artifact()to log feature importance data as a CSV file for later analysis. - C
Use
mlflow.log_metric()to log SHAP values directly for visualization in the MLflow UI. - D
Use
mlflow.log_figure()to log SHAP plots as visualizations and view them in the MLflow UI. - E
Use
mlflow.log_param()to log metadata like model version or hyperparameters.
Show answer and explanation
Correct answers: A, B, D, E
Explanation
To effectively log and view artifacts such as SHAP plots, feature importance data, and metadata in MLflow, you should use appropriate logging methods. mlflow.log_artifact() is versatile for logging files, while mlflow.log_figure() is tailored for visualizations. Additionally, mlflow.log_param() helps track metadata. Avoid using mlflow.log_metric() for complex data, as it is intended for scalar metrics.
- A. Correct.
This is correct because
mlflow.log_artifact()is commonly used to log files, such as images, which can then be accessed via the MLflow UI. - B. Correct.
This is correct because
mlflow.log_artifact()can also be used to log feature importance or other data as files (e.g., CSV), making it available for later analysis. - C. Incorrect.
This is incorrect because
mlflow.log_metric()is used for logging scalar metrics (e.g., accuracy, loss) rather than complex data like SHAP values. - D. Correct.
This is correct because
mlflow.log_figure()is specifically designed for logging visualizations, such as SHAP plots, making it easy to view these visualizations within the MLflow UI. - E. Correct.
This is correct because
mlflow.log_param()is used to log metadata like model hyperparameters or versioning information, which is crucial for experiment tracking.