Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

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

BigQuery ML

Professional Machine Learning Engineer · Lesson 1 of 19 · 3:56

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: matching the model to the business problem (classification, regression, forecasting with ARIMA_PLUS or TimesFM, k-means clustering), automatic preprocessing and the TRANSFORM clause, feature importance, ML.EVALUATE, ML.PREDICT, and ML.FORECAST, and tuning and calling Gemini from BigQuery through a remote model. 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.

Machine learning where the data is

Cymbal Insurance keeps ten years of policies, claims, and renewals in BigQuery, and its analysts write SQL every day. Three questions come up again and again: which policyholders will leave at renewal, how many claims will arrive next month, and which customers behave alike. With BigQuery ML, the team can answer all three in SQL, without moving the data or writing a training application.

Match the model to the problem

Start from the business problem, not from the algorithm. A yes or no answer, like whether a policyholder will leave, is classification: a logistic regression, or a boosted tree classifier. A number, like the cost of a repair, is regression: a linear regression, or a boosted tree regressor. Values over time, like claims per week, call for forecasting, with an ARIMA_PLUS model, or the built-in TimesFM model through the AI.FORECAST function. And when there is no label at all, like finding customer segments, k-means clustering groups similar rows.

Trained inside or outside BigQuery

Some model types are trained inside BigQuery, like linear and logistic regression, k-means, matrix factorization for recommendations, and the time series models. Others, like deep neural networks, boosted trees, random forests, and AutoML, are trained in Gemini Enterprise Agent Platform, the new name of Vertex AI, while you still write the same SQL. You can also import models trained elsewhere, like TensorFlow, ONNX, or XGBoost models, and use them for predictions in BigQuery.

Preparing features

BigQuery ML prepares features for you: it fills missing numbers with the column mean, standardizes numeric columns for most model types, and one-hot encodes text categories. When you need more, add a TRANSFORM clause to the CREATE MODEL statement, with functions like bucketize, feature cross, or a standard scaler. The clause is saved with the model, so predictions get exactly the same preprocessing, with no code to copy. To select features, the feature importance function shows how much each column helped a boosted tree or a random forest, so you can drop the columns that add nothing.

Getting predictions

To score data, call ML.PREDICT with the model and a table or a query: it returns the input rows with a predicted label and, for classifiers, a probability for each class. Time series models use ML.FORECAST instead, with a horizon and a confidence level. Before trusting a model, ML.EVALUATE scores it on evaluation data, with precision and recall for classifiers, or error measures for regression. And when an application needs answers in milliseconds, you register the model in Model Registry and deploy it to an endpoint, which lesson twelve covers.

Tuning Gemini from BigQuery

BigQuery ML also reaches Gemini models, through a remote model that uses a Cloud resource connection. When prompts alone do not give a consistent style or format, you can tune Gemini from BigQuery: a CREATE MODEL statement on the remote model, with a training query that returns a prompt column and a label column of expected answers. Then ML.EVALUATE compares the tuned model with the base model on held-out examples, and AI.GENERATE_TEXT produces text with whichever model wins. The tuning runs in Agent Platform, but the team never leaves SQL.

Recap

Let's recap. Classification answers yes or no questions, regression predicts numbers, forecasting predicts values over time, and k-means clustering finds groups without labels. BigQuery ML preprocesses features automatically, and the TRANSFORM clause saves custom preprocessing with the model. The feature importance function helps you keep the columns that matter. ML.PREDICT and ML.FORECAST score data in SQL, after ML.EVALUATE checks the model. And a remote model lets you tune and call Gemini from BigQuery, with prompt and label 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.

  1. The marketing team wants to split policyholders into groups that behave alike, but nobody has ever labeled these groups. Which BigQuery ML model type fits?

    • A logistic regression classifier
    • K-means clustering
    • An ARIMA_PLUS time series model
    • A linear regression model
    Show the answer

    K-means clustering

    K-means clustering groups similar policyholders, and it needs no labels. “A logistic regression classifier” would need a labeled yes or no column to learn from. “An ARIMA_PLUS time series model” only forecasts values over time, and finds no groups. And “A linear regression model” would predict a number, and it also needs a label.

  2. A data scientist bucketizes driver ages and crosses vehicle type with region before training a renewal model. Analysts will call the model from SQL, and must not repeat this preparation by hand. What should be used?

    • Views that analysts apply before predicting
    • A Dataflow job that prepares each prediction table
    • Separate preprocessing queries in a scheduled script
    • A TRANSFORM clause in the CREATE MODEL statement
    Show the answer

    A TRANSFORM clause in the CREATE MODEL statement

    The TRANSFORM clause is saved with the model, so every prediction gets the same preparation automatically. “Views that analysts apply before predicting” would rely on analysts remembering to apply the views. “A Dataflow job that prepares each prediction table” would add a separate pipeline to build and keep in sync. And “Separate preprocessing queries in a scheduled script” would leave two copies of the logic, which can drift apart.

  3. Adjusters want summaries in the house format, but even detailed prompts give a different layout each time. 2,000 good examples sit in a BigQuery table, and the team works only in SQL. What should it do?

    • Tune a Gemini remote model with CREATE MODEL on the examples
    • Train a k-means model on the examples
    • Write a longer prompt for every summary
    • Export the examples and train a PyTorch model
    Show the answer

    Tune a Gemini remote model with CREATE MODEL on the examples

    Supervised tuning from BigQuery teaches Gemini the house format from the examples, all in SQL. “Train a k-means model on the examples” only groups rows, and generates no text. “Write a longer prompt for every summary” would keep the inconsistent results that prompts already give. And “Export the examples and train a PyTorch model” would need a training application in Python, which the team does not write.