Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Google Cloud · Professional Machine Learning Engineer

Validation and preprocessing

Professional Machine Learning Engineer · Lesson 16 of 19 · 2:02:19

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.

In this lesson

Prepare for the Google Cloud Professional Machine Learning Engineer exam, on the official exam guide. In this lesson: data validation with TensorFlow Data Validation (schemas and anomalies), model validation against production or a baseline, training-serving skew and its causes, and consistent preprocessing (the BigQuery ML TRANSFORM clause, TensorFlow Transform, Feature Store, custom inference routines). 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.

The pipeline that never said no

One night, a source system at Cymbal Insurance renamed a column. The pipeline trained anyway, on half empty data, and deployed a worse fraud model the next morning. Automation without checks only makes mistakes faster.

Data validation

Validate the data before training. TensorFlow Data Validation computes statistics on the new data, and compares them with a schema that records what you expect: the features, their types, and their ranges. A schema anomaly, like a missing feature, an unexpected feature, or values of the wrong type, should stop the pipeline, so the team can investigate. A significant change in the values themselves, like a new pattern of claims, is a reason to retrain instead.

Model validation

Validate the model after training, before it reaches production. Compute its evaluation metrics on a test set, and compare them with the current production model, or with a baseline. In a pipeline, a condition step deploys the new model only if it beats that bar, and otherwise the pipeline stops, with the old model still in place. And after deployment, a canary rollout, as in lesson thirteen, gives a final check on real traffic.

Training serving skew

Training serving skew appears when the data seen in production differs from the training data. One cause is different code paths, like SQL for training and application code for serving. Another is a training set drawn from a different source, or a biased sample, like weekdays only. TensorFlow Data Validation can compare training statistics with serving statistics, and flag the features whose distributions differ.

Consistent preprocessing

The surest fix is to write each transformation once, where training and serving both use it. In BigQuery ML, the TRANSFORM clause stores the preprocessing with the model, and ML.PREDICT applies it automatically. TensorFlow Transform computes values that need a full pass over the data, like a mean or a vocabulary, with Apache Beam, and builds them into the TensorFlow graph, so serving applies exactly the same steps. Feature Store shares feature definitions, as in lesson five. And custom inference routines keep serving side preprocessing in one place.

Recap

Let's recap. Data validation compares statistics with a schema: schema anomalies stop the pipeline, and value changes call for retraining. Model validation compares new metrics with the production model or a baseline, and a condition step deploys only a better model. Training serving skew comes from different code, different sources, or biased samples. TensorFlow Data Validation can compare training and serving statistics. And the TRANSFORM clause, TensorFlow Transform, Feature Store, and custom inference routines keep preprocessing in one place.

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.

  1. A source system dropped the policy age column overnight. The weekly pipeline must never train on such data again. What should the pipeline include?

    • A model evaluation step after training
    • A data validation step against a schema
    • More nodes for the training step
    • A step that fills missing columns with zeros
    Show the answer

    A data validation step against a schema

    Data validation compares the new data with the schema, finds the missing column, and stops the pipeline before training. “A model evaluation step after training” would only check the model after it has trained on broken data. “More nodes for the training step” would add capacity, but no check at all. And “A step that fills missing columns with zeros” would hide the problem, by training on a column of guesses.

  2. A model was trained on a sample of weekday claims only, but production receives claims every day of the week. The team suspects that some features look different in production. How can it confirm this?

    • Measure the endpoint's latency
    • Retrain on the same weekday sample
    • Compare training and serving statistics
    • Evaluate the model on its test set again
    Show the answer

    Compare training and serving statistics

    Comparing training and serving statistics shows which feature distributions differ, which confirms the skew. “Measure the endpoint's latency” would measure speed, not the data. “Retrain on the same weekday sample” would retrain on the same biased sample. And “Evaluate the model on its test set again” would only measure the model on the same weekday data.

  3. A TensorFlow model needs features scaled with the mean and standard deviation of the full training set, and a vocabulary built from all claims. Serving must apply exactly the same steps. What should the team use?

    • Scaling code that runs on each request
    • Separate scripts for training and serving
    • TensorFlow Data Validation
    • TensorFlow Transform
    Show the answer

    TensorFlow Transform

    TensorFlow Transform computes the full pass values with Apache Beam, and builds the transformations into the model's graph for serving. “Scaling code that runs on each request” would compute the values on each request, not over the full training set. “Separate scripts for training and serving” would keep two copies of the logic, which is how skew begins. And “TensorFlow Data Validation” would only check the data, without transforming anything.