Google Professional Machine Learning Engineer Question 371
Single answerGoogle Cloud PlatformYou are designing a machine learning pipeline on Google Cloud. During training, you use a custom Python script to normalize your dataset and handle missing values. For serving, your model will be deployed to Vertex AI for online predictions. How can you ensure that the same data pre-processing logic is consistently applied during both training and serving?
- A
Export the pre-processing steps as a TensorFlow Transform (TFX) graph and deploy it alongside your model.
- B
Include the pre-processing logic directly in the model code during training and serving.
- C
Use Cloud Dataflow to run the same pre-processing pipeline for both training and serving.
- D
Write the pre-processing logic in JavaScript and integrate it with Vertex AI for consistent serving.
Show answer and explanation
Correct answer: A
Explanation
Ensuring consistent data pre-processing between training and serving is critical for maintaining model accuracy. TensorFlow Transform (TFX) is designed to address this issue by enabling you to define pre-processing steps as part of a TensorFlow graph. These steps are then applied consistently during training and serving, reducing the risk of data discrepancies.
- A. Correct.
Correct. TensorFlow Transform (TFX) allows you to define pre-processing steps as part of a TF graph, ensuring consistency between training and serving.
- B. Incorrect.
Incorrect. Including the pre-processing logic directly in the model code can lead to inconsistencies and is not a scalable or recommended approach.
- C. Incorrect.
Incorrect. While Cloud Dataflow can be used for pre-processing, it doesn’t directly ensure consistency between training and serving without additional integration.
- D. Incorrect.
Incorrect. Writing pre-processing in JavaScript is not a standard or recommended practice for Vertex AI and may result in inconsistencies.