Exploring and preparing data
Professional Machine Learning Engineer · Lesson 4 of 19 · 31:03
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Google Cloud Professional Machine Learning Engineer exam, on the official exam guide. In this lesson: where each type of data belongs (BigQuery, Cloud Storage, managed datasets with import files), choosing a tool by scale (pandas, BigQuery SQL and DataFrames, Dataflow, Managed Service for Apache Spark), Sensitive Data Protection (infoTypes, masking, tokenization, date shifting), and exploring data before training (label balance, missing values, leaking columns). Includes three original practice questions, with Cymbal Insurance, a fictional car and home insurer, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Data in every shape
Before any model, Cymbal Insurance's data must be found, cleaned, and protected. It comes in every shape: policy tables, adjusters' notes, photos of damaged cars, and recorded calls. And much of it identifies real people, through names, addresses, and license plates.
Organizing data by type
Tabular data belongs in BigQuery, where you can explore it with SQL, join it, and split it for training. Unstructured data, like images, audio, video, and documents, belongs in Cloud Storage, with an import file that lists each object's path and its label. A managed dataset in Agent Platform ties these files and labels together, with training, validation, and test splits that AutoML and serverless training can reuse. Text can go in either place: short notes as a column in BigQuery, long documents as files in Cloud Storage.
Choosing the preprocessing tool
Choose the tool by scale and complexity. When the data fits in one machine's memory, in-memory Python with pandas or scikit-learn is the fastest way to prototype. For structured data at any scale, SQL in BigQuery filters, joins, and aggregates without servers to manage, and BigQuery DataFrames offers a pandas-style API that runs in BigQuery. For complex logic on large or streaming data, like parsing millions of documents, Dataflow runs Apache Beam pipelines, in batch or streaming. And when the team already has Spark code, Managed Service for Apache Spark, formerly Dataproc, runs it with little change.
Protecting personal data
Personal data needs care at every step. Sensitive Data Protection, formerly Cloud DLP, inspects data with built-in detectors, called infoTypes, for things like names, phone numbers, and card numbers, and its discovery service profiles whole BigQuery datasets to show where sensitive columns are. It can then de-identify the data: mask characters, redact or replace values, swap them for consistent cryptographic tokens that still allow joins, or shift dates while keeping the gaps between them. Train on de-identified data whenever the model does not need the real values, and keep only the columns that the model needs.
Exploring before training
Explore before you train. Check the label balance, because fraud is rare, and a model can look accurate while missing every fraud case. Look for missing values, outliers, and repeated rows, and make sure that no column leaks the answer, like a payout date that only exists for approved claims.
Recap
Let's recap. Tabular data goes in BigQuery, and images, audio, video, and documents go in Cloud Storage, with an import file of paths and labels. Pandas suits data that fits in memory, BigQuery SQL suits structured data at any scale, Dataflow suits complex or streaming work, and Spark suits existing Spark code. Sensitive Data Protection finds personal data with infoTypes, and de-identifies it with masking, tokens, or date shifting. Consistent tokens keep joins possible without exposing real values. And before training, check the label balance, missing values, and leaking columns.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Every day, 3 TB of claim events must be joined with policy tables and aggregated per customer; the data already sits in BigQuery. The team wants the simplest option, no cluster to run. Which tool fits?
- pandas on a notebook virtual machine
- SQL in BigQuery
- A new Spark cluster for the joins
- A Python script on a laptop
Show the answer
SQL in BigQuery
SQL in BigQuery joins and aggregates terabytes, with no cluster to manage. “pandas on a notebook virtual machine” would need the data to fit in one machine's memory, which three terabytes do not. “A new Spark cluster for the joins” would add a cluster to run, for work that SQL already does. And “A Python script on a laptop” could never hold that much data.
A fraud model must link claims from the same person across tables, but data scientists must never see real policy numbers. What should the team do?
- Delete the policy number column
- Mask the last four digits only
- Replace policy numbers with consistent tokens
- Give read access to the raw table
Show the answer
Replace policy numbers with consistent tokens
Consistent cryptographic tokens hide the real numbers, but the same number always gets the same token, so claims still link. “Delete the policy number column” would make it impossible to link claims from the same person. “Mask the last four digits only” would still show most of each real number. And “Give read access to the raw table” would expose the real numbers that must stay hidden.
A dataset holds 500,000 claims, and only one in 200 is fraud. A first model reaches 99% accuracy. What should the team check first?
- Its recall on the fraud class
- The number of columns
- The size of the bucket
- The training time
Show the answer
Its recall on the fraud class
With so few fraud cases, a model that never predicts fraud reaches the same accuracy, so recall on the fraud class shows whether it catches anything. “The number of columns” is unrelated to the fraud cases. “The size of the bucket” only describes storage. And “The training time” only measures speed, not quality.