Fatskills
Practice. Master. Repeat.
Study Guide: Cloud ML - Google Cloud Professional Machine Learning Engineer: Data Sources and Strategy (Structured vs Unstructured, Real‑time vs Batch)
Source: https://www.fatskills.com/machine-learning-101/chapter/cloud-ml-cert-gcp-ml-data-sources-and-strategy-structured-vs-unstructured-realtime-vs-batch

Cloud ML - Google Cloud Professional Machine Learning Engineer: Data Sources and Strategy (Structured vs Unstructured, Real‑time vs Batch)

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~7 min read

GCP_ML – Data Sources and Strategy (Structured vs Unstructured, Real‑time vs Batch)


Google Cloud Professional Machine Learning Engineer: Data Sources & Strategy Study Guide

(Structured vs. Unstructured, Real-Time vs. Batch)


What This Is

This topic covers how to choose, ingest, and process data for ML pipelines in Google Cloud. The exam tests your ability to select the right data source type (structured vs. unstructured, batch vs. real-time) and design a scalable, cost-effective strategy for training and inference.

Real-world scenario:
A retail company wants to predict customer churn using: - Batch data (historical purchase records from BigQuery).
- Real-time data (clickstream events from Pub/Sub).
- Unstructured data (customer support call transcripts in Cloud Storage).
You must decide whether to preprocess data in BigQuery (batch) or Dataflow (streaming), store features in Vertex AI Feature Store, and serve predictions via Vertex AI Prediction (online) or BigQuery ML (batch).


Key Terms & Services


Data Types & Sources

  • Structured data: Tabular data (rows/columns) stored in databases (e.g., BigQuery, Cloud SQL) or spreadsheets. Best for supervised learning (classification, regression).
  • Unstructured data: Text, images, audio, or video (e.g., PDFs in Cloud Storage, logs in Cloud Logging). Requires embeddings (Vertex AI Text Embeddings, Vision API) or preprocessing (Dataflow, Dataproc).
  • Semi-structured data: JSON, Avro, or Parquet files (e.g., Pub/Sub messages, Firestore documents). Often used in real-time pipelines.

Ingestion & Processing

  • Cloud Storage (GCS): Google’s object storage (like AWS S3). Stores raw data, model artifacts, and training datasets. Use multi-regional buckets for low-latency access.
  • BigQuery: Serverless data warehouse for batch SQL queries. Best for structured data analysis (e.g., aggregating historical sales data). Supports BigQuery ML for in-database ML.
  • Pub/Sub: Real-time messaging service for streaming data (e.g., IoT sensor data, clickstreams). Integrates with Dataflow for processing.
  • Dataflow: Managed Apache Beam service for batch or streaming ETL. Use for real-time feature engineering (e.g., aggregating user sessions from Pub/Sub).
  • Dataproc: Managed Spark/Hadoop for large-scale batch processing (e.g., preprocessing unstructured data before training).
  • Cloud SQL / Spanner: Managed relational databases for transactional data (e.g., user profiles). Use Cloud SQL for small-scale and Spanner for global scale.

Feature Engineering & Storage

  • Vertex AI Feature Store: Managed repository for storing, sharing, and serving ML features. Reduces training-serving skew by ensuring consistent feature values.
  • BigQuery ML: Train ML models directly in BigQuery (e.g., logistic regression for churn prediction). Best for batch predictions on structured data.
  • TensorFlow Data Validation (TFDV): Detects data drift, anomalies, and schema skew in training datasets. Integrates with Vertex AI Pipelines.

Real-Time vs. Batch Tradeoffs

Factor Batch Processing Real-Time Processing
Latency High (hours/days) Low (milliseconds/seconds)
Use Case Training, batch predictions Fraud detection, recommendations
Cost Lower (pay per job) Higher (always-on services)
Services BigQuery, Dataproc, Vertex AI Batch Prediction Dataflow, Pub/Sub, Vertex AI Online Prediction


Step-by-Step / Process Flow


1. Choose Your Data Source & Ingestion Strategy

  • For batch (structured):
  • Store raw data in BigQuery (if SQL-friendly) or Cloud Storage (Parquet/CSV).
  • Use BigQuery ML for simple models or Vertex AI Training for custom models.
  • For batch (unstructured):
  • Store in Cloud Storage (e.g., images, PDFs).
  • Preprocess with Dataproc (Spark) or Dataflow (Beam).
  • For real-time (structured/semi-structured):
  • Ingest via Pub/Sub (e.g., clickstream events).
  • Process with Dataflow (e.g., sessionization, aggregations).
  • Store features in Vertex AI Feature Store for low-latency serving.

2. Preprocess & Validate Data

  • For batch:
  • Use BigQuery SQL or Dataproc (PySpark) to clean/transform data.
  • Validate with TFDV (e.g., check for missing values, drift).
  • For real-time:
  • Use Dataflow to apply transformations (e.g., windowed aggregations).
  • Write processed data to BigQuery (batch) or Feature Store (real-time).

3. Store Features for Training & Serving

  • Option 1: BigQuery (batch-only)
  • Cheaper, but not real-time.
  • Use for training data (e.g., historical churn records).
  • Option 2: Vertex AI Feature Store (real-time + batch)
  • Store precomputed features (e.g., user’s 30-day purchase history).
  • Serve features online (low-latency) or offline (batch training).

4. Train & Deploy the Model

  • Batch training:
  • Use Vertex AI Training (custom containers) or BigQuery ML (SQL-based models).
  • Real-time inference:
  • Deploy to Vertex AI Prediction (online endpoint).
  • Use Feature Store to fetch features at prediction time.

5. Monitor & Maintain

  • Data drift: Use Vertex AI Model Monitoring to detect feature skew.
  • Performance: Log predictions with Cloud Logging and monitor latency in Cloud Monitoring.


Common Mistakes


Mistake 1: Using BigQuery for Real-Time Feature Serving

  • Why it’s wrong: BigQuery is not designed for low-latency lookups (typical query time: seconds).
  • Correction: Use Vertex AI Feature Store for real-time feature serving (latency: milliseconds).

Mistake 2: Storing Raw Unstructured Data in BigQuery

  • Why it’s wrong: BigQuery is not optimized for binary data (e.g., images, audio). Costs explode with large blobs.
  • Correction: Store unstructured data in Cloud Storage and process with Dataproc (Spark) or Dataflow.

Mistake 3: Ignoring Training-Serving Skew

  • Why it’s wrong: Features computed differently in training (batch) vs. serving (real-time) lead to poor model performance.
  • Correction: Use Vertex AI Feature Store to ensure consistent feature computation in both phases.

Mistake 4: Choosing Dataproc for Real-Time Processing

  • Why it’s wrong: Dataproc is batch-only (Spark/Hadoop). Real-time requires Dataflow (Beam).
  • Correction: Use Dataflow for streaming ETL (e.g., aggregating Pub/Sub events).

Mistake 5: Not Validating Data Before Training

  • Why it’s wrong: Garbage in = garbage out. Missing values, outliers, or drift can ruin model performance.
  • Correction: Use TensorFlow Data Validation (TFDV) to detect anomalies before training.


Certification Exam Insights


1. Service Selection Traps

  • BigQuery ML vs. Vertex AI Training:
  • Use BigQuery ML for simple models (linear regression, logistic regression) on structured data.
  • Use Vertex AI Training for custom models (TensorFlow, PyTorch) or unstructured data.
  • Dataflow vs. Dataproc:
  • Dataflow = real-time or batch ETL (Apache Beam).
  • Dataproc = batch-only (Spark/Hadoop).
  • Pub/Sub vs. Cloud Storage:
  • Pub/Sub = real-time event streaming (e.g., clickstream).
  • Cloud Storage = batch file storage (e.g., training datasets).

2. Key Constraints

  • Vertex AI Feature Store:
  • Online store has <10ms latency but costs more than offline.
  • Offline store is cheaper but not real-time.
  • BigQuery ML:
  • Max model size: 10GB (not for large deep learning models).
  • Supports only structured data (no images/text).

3. "Which Service?" Scenarios

  • Scenario: A team needs to process 10TB of log files daily for ML training. Which service?
  • Answer: Dataproc (Spark) – Best for large-scale batch processing of unstructured data.
  • Scenario: A fraud detection model needs sub-second predictions on streaming transactions. Which service?
  • Answer: Dataflow (real-time processing) + Vertex AI Online Prediction – Low-latency pipeline.


Quick Check Questions


Question 1

A gaming company wants to predict player churn using: - Historical gameplay data (structured, in BigQuery).
- Real-time in-game events (semi-structured, from Pub/Sub).
Which two services should they use to ingest and process this data for training?

Answer:
- BigQuery (for batch historical data) + Dataflow (for real-time Pub/Sub events).
Why: BigQuery handles structured batch data, while Dataflow processes streaming events.


Question 2

A healthcare startup is building a real-time patient monitoring system that predicts sepsis risk. They need to: 1. Ingest vital signs from IoT devices (streaming).
2. Fetch historical lab results (batch, in BigQuery).
3. Serve predictions within 100ms.
Which three services should they use?

Answer:
- Pub/Sub (ingest streaming vitals) → Dataflow (process real-time data) → Vertex AI Feature Store (fetch historical lab results + serve features).
Why: Pub/Sub + Dataflow handle streaming, while Feature Store ensures low-latency feature serving.


Question 3

A retail company wants to train a recommendation model using: - Customer purchase history (structured, in BigQuery).
- Product images (unstructured, in Cloud Storage).
They want the cheapest and simplest solution. Which two services should they use?

Answer:
- BigQuery ML (for structured purchase data) + Vertex AI Training (for image embeddings).
Why: BigQuery ML is cheap for structured data, while Vertex AI handles unstructured data.


Last-Minute Cram Sheet

  1. Structured dataBigQuery, Cloud SQL, Spanner (tabular).
  2. Unstructured dataCloud Storage (images, text) + Dataproc/Dataflow (processing).
  3. Real-time ingestionPub/Sub (streaming) → Dataflow (processing).
  4. Batch ingestionCloud Storage (files) or BigQuery (tables).
  5. Feature StoreVertex AI Feature Store (real-time + batch features).
  6. BigQuery MLSimple models (SQL-based), structured data only.
  7. Vertex AI TrainingCustom models (TensorFlow/PyTorch), unstructured data.
  8. ⚠️ Dataflow vs. Dataproc: Dataflow = real-time, Dataproc = batch.
  9. ⚠️ BigQuery is not for real-time serving (use Feature Store instead).
  10. ⚠️ TFDV detects data drift – always validate before training!


ADVERTISEMENT