Google Professional Machine Learning Engineer Question 370
Select 2Google Cloud PlatformYou are building a machine learning model on Google Cloud that classifies customer feedback. During training, you apply a custom data normalization step to scale the input features. To ensure consistent preprocessing between training and serving, which of the following approaches should you take?
- A
Write and apply the same custom normalization logic in both your training code and serving application.
- B
Use TensorFlow Transform (TFT) to define and execute the preprocessing steps, and export the transformations as part of the SavedModel.
- C
Manually document the preprocessing steps and share the documentation with the team responsible for the serving application.
- D
Utilize Google Cloud Dataflow to apply the same preprocessing logic to both training and serving pipelines.
- E
Rely on the model to handle any inconsistencies in the input data during serving.
Show answer and explanation
Correct answers: B, D
Explanation
Ensuring consistent data preprocessing between training and serving is critical to avoid data skew and maintain the performance of machine learning models in production. Tools like TensorFlow Transform (TFT) and Google Cloud Dataflow are designed to address this challenge by enabling reusable and consistent preprocessing logic across both stages. These approaches reduce manual effort and minimize the risk of errors or mismatches.
- A. Incorrect.
While writing the same logic for training and serving might work in theory, it is error-prone and difficult to maintain. Any slight mismatch in the implementation can lead to inconsistent behavior.
- B. Correct.
Using TensorFlow Transform (TFT) allows you to define preprocessing steps once and ensures they are applied consistently during both training and serving, as the transformations are baked into the exported SavedModel.
- C. Incorrect.
Manually documenting preprocessing steps is not a reliable approach. It introduces the risk of human error and does not guarantee consistency in implementation.
- D. Correct.
Google Cloud Dataflow can be used to build unified pipelines for preprocessing, ensuring the same transformations are applied consistently to both training and serving data.
- E. Incorrect.
Relying on the model to handle inconsistencies is not a best practice. The model expects data in a consistent format, and preprocessing should address any discrepancies beforehand.