Google Cloud Professional Machine Learning Engineer — Question 257
You want to migrate a scikit-learn classifier model to TensorFlow. You plan to train the TensorFlow classifier model using the same training set that was used to train the scikit-learn model, and then compare the performances using a common test set. You want to use the Vertex AI Python SDK to manually log the evaluation metrics of each model and compare them based on their F1 scores and confusion matrices. How should you log the metrics?
Answer options
- A. Use the aiplatform.log_classification_metrics function to log the F1 score, and use the aiplatform.log_metrics function to log the confusion matrix.
- B. Use the aiplatform.log_classification_metrics function to log the F1 score and the confusion matrix.
- C. Use the aiplatform.log_metrics function to log the F1 score and the confusion matrix.
- D. Use the aiplatform.log_metrics function to log the F1 score: and use the aiplatform.log_classification_metrics function to log the confusion matrix.
Correct answer: D
Explanation
Option D is correct because it specifies using the appropriate functions to log the F1 score and the confusion matrix separately, which aligns with the intended use of the Vertex AI Python SDK. The other options either incorrectly combine the metrics into a single function or misassign the functions, which would not correctly log the metrics as needed for evaluation.