CERTIFIED-MACHINE-LEARNING-PROFESSIONAL · Question #39
CERTIFIED-MACHINE-LEARNING-PROFESSIONAL Question #39: Real Exam Question with Answer & Explanation
Option A likely uses mlflow.log_artifact(importance_path), which is the correct MLflow API method for logging a local file (such as a CSV) as an artifact associated with the current run - it takes the file path as its argument and uploads the file to the artifact store. Option C
Question
A machine learning engineer wants to log feature importance data from a CSV file at path importance_path with an MLflow run for model model. Which of the following code blocks will accomplish this task inside of an existing MLflow run block? A. B.
Options
- Cmlflow.log_data(importance_path, "feature-importance.csv")
- Dmlflow.log_artifact(importance_path, "feature-importance.csv")
- ENone of these code blocks tan accomplish the task.
Explanation
Option A likely uses mlflow.log_artifact(importance_path), which is the correct MLflow API method for logging a local file (such as a CSV) as an artifact associated with the current run - it takes the file path as its argument and uploads the file to the artifact store.
Option C is wrong because mlflow.log_data() does not exist in the MLflow API; there is no such method, so this would raise an AttributeError.
Option D is subtly wrong: mlflow.log_artifact(importance_path, "feature-importance.csv") misuses the second parameter - the second argument to log_artifact is artifact_path, which specifies a subdirectory within the artifact store to place the file, not a new filename. Passing a .csv filename there would create an oddly named subdirectory rather than rename the artifact.
Memory tip: Think "artifact = file" - mlflow.log_artifact(path) logs a file artifact. Contrast it with mlflow.log_metric() (single number) and mlflow.log_param() (hyperparameter string). If you're saving a whole file, log_artifact is your tool.
Community Discussion
No community discussion yet for this question.