What is the TRANSFORM clause in BigQuery ML, and why is it valuable for preprocessing?

Quick Overview

Asks what the TRANSFORM clause does in a BigQuery ML CREATE MODEL statement and why it helps with feature preprocessing. It tests understanding of training/serving skew, preprocessing functions that learn statistics from training data, and the limits of keeping feature logic inside the model.

What is the TRANSFORM clause in BigQuery ML, and why is it valuable for preprocessing?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: medium

Interview Round: Other

What is the `TRANSFORM` clause in BigQuery ML, and why is it valuable for preprocessing? ```hint Where the statistics live Think about where the mean and standard deviation used to scale a feature are kept after training, and what a separate scoring query would have to do without them. ``` ### What a Strong Answer Covers - Where the clause sits in a `CREATE MODEL` statement and what is stored with the model - What happens to new rows passed to `ML.PREDICT` for a model trained with the clause - The production problem the clause prevents, and why it prevents it - Which preprocessing functions learn statistics from the training data and which do not - The limits of the approach ### Follow-up Questions - If you computed the mean and standard deviation with `AVG() OVER()` in the training query instead, what would go wrong at prediction time? - The feature distribution drifts after deployment. What does a model with a `TRANSFORM` clause do with its old scaling statistics? - Which preprocessing steps cannot live inside `TRANSFORM`, and how would you keep those consistent between training and serving?

Overview: Asks what the TRANSFORM clause does in a BigQuery ML CREATE MODEL statement and why it helps with feature preprocessing. It tests understanding of training/serving skew, preprocessing functions that learn statistics from training data, and the limits of keeping feature logic inside the model.

General logo
General
Nov 25, 2026
mediumData ScientistOtherData Manipulation (SQL/Python)
0
0

What is the TRANSFORM clause in BigQuery ML, and why is it valuable for preprocessing?

What a Strong Answer Covers Guidance

  • Where the clause sits in a CREATE MODEL statement and what is stored with the model
  • What happens to new rows passed to ML.PREDICT for a model trained with the clause
  • The production problem the clause prevents, and why it prevents it
  • Which preprocessing functions learn statistics from the training data and which do not
  • The limits of the approach

Follow-up Questions Guidance

  • If you computed the mean and standard deviation with AVG() OVER() in the training query instead, what would go wrong at prediction time?
  • The feature distribution drifts after deployment. What does a model with a TRANSFORM clause do with its old scaling statistics?
  • Which preprocessing steps cannot live inside TRANSFORM , and how would you keep those consistent between training and serving?