How to preprocess BigQuery data for TensorFlow?
You are developing a custom TensorFlow classification model based on tabular data. Your raw data is stored in BigQuery. contains hundreds of millions of rows, and includes both categorical and numerical features. You need to use a MaxMin scaler on some numerical features, and apply a one-hot encoding to some categorical features such as SKU names. Your model will be trained over multiple epochs. You want to minimize the effort and cost of your solution. What should you do?
Community Votes
47% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests the use of TFX and Dataflow for complex preprocessing, where the trap is underestimating the complexity of implementing full-pass stateful transformations in SQL.
For large-scale tabular data preprocessing requiring stateful transformations like scaling and encoding, using TFX components with Dataflow is the recommended approach. The community consensus supports this method for its ability to efficiently handle distributed processing and pipeline integration, minimizing engineering effort.
Choosing BigQuery (Option B or D) is a common mistake because while it appears cost-effective, implementing stateful transformations like MinMax scaling requires complex auxiliary tables and multiple data passes, increasing effort.
Community Discussion (16 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option C is correct because TFX components, specifically the Transform component with Dataflow, are designed to handle full-pass stateful transformations (like MinMax scaling) and complex encoding on large datasets efficiently. This approach minimizes the engineering effort required to write and maintain complex SQL queries for preprocessing and integrates seamlessly with the TensorFlow training pipeline. As noted in comments, Dataflow provides the distributed processing power necessary for hundreds of millions of rows.Why the Other Options Are Wrong
Options A, B, and D suggest using BigQuery for scaling, which involves writing manual SQL queries. Implementing a MinMax scaler in SQL requires calculating global min and max values, often necessitating complex joins or separate lookup tables (as hinted in Option A), which increases effort and potential for error. While some comments argue for BigQuery's cost-effectiveness, the question emphasizes minimizing the effort of the solution, and managing complex stateful transformations in SQL is inherently more labor-intensive than using a dedicated preprocessing component like TFX.Community Comment Notes
There is significant debate in the comments regarding cost versus effort, with some users preferring BigQuery for its simplicity and lower immediate cost (Comments 2, 4). However, top-voted comments highlight that "full-pass stateful transformations aren't suitable for implementation in BigQuery" without auxiliary tables, leading to increased complexity (Comment 1). Others point out that for multiple epochs, a pipeline approach like TFX allows for efficient data handling and persistence (Comment 6, 9).Official Reference
Exam Strategy
When you encounter questions involving large datasets and specific preprocessing steps like scaling or encoding, prioritize managed MLOps tools like TFX over manual SQL. Remember that while BigQuery is excellent for storage and querying, complex stateful transformations are best handled by Dataflow to reduce engineering effort.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →