7.1 Planning an ML Project: BigQuery ML, AutoML, or Pretrained Models?

Key Takeaways

  • ML fits when there is a learnable pattern, historical labeled outcomes for supervised problems, and a decision the prediction will change; otherwise use a SQL rule.

  • Common task types map to BigQuery ML models: classification (LOGISTIC_REG, BOOSTED_TREE_CLASSIFIER), regression (LINEAR_REG), forecasting (ARIMA_PLUS), clustering (KMEANS), and recommendation (MATRIX_FACTORIZATION).

  • A standard ML project moves through framing, data collection and preparation, splitting, training, evaluation, prediction, and monitoring.

  • BigQuery ML AutoML (AUTOML_CLASSIFIER or AUTOML_REGRESSOR) automates feature engineering and model search within a BUDGET_HOURS budget of 1.0 to 72.0 hours (default 1.0).

  • Data leakage, such as using a refund date to predict returns, inflates evaluation scores and makes production predictions useless.

Last updated: October 2026

7.1 Planning an ML Project: BigQuery ML, AutoML, or Pretrained Models?

Core Focus: Exam section 2.3 starts before any SQL is written: identify which business problems suit machine learning, plan a standard ML project (data collection, training, evaluation, prediction), and choose between BigQuery ML, AutoML, and pretrained models. The rest of this chapter then covers training (7.2), inference and Model Registry (7.3), and large language models (7.4).

Vertex AI, the platform behind AutoML and Model Registry, was renamed Gemini Enterprise Agent Platform in April 2026. The exam guide uses the older names.


Is Machine Learning the Right Tool?

ML fits when all of these are true:

  • There is a pattern to learn that is hard to write as fixed rules (which customers will cancel, what demand will be next month).
  • There is historical data with the outcome, called the label, for supervised problems (past customers marked "churned" or "stayed").
  • A prediction changes a decision (who gets a retention offer, how much stock to order).

If a simple SQL rule answers the question ("flag orders over $10,000 for review"), use the rule. The exam rewards the simplest solution that meets the requirement.


Matching Business Problems to ML Task Types

Business questionML taskLabelBigQuery ML model types
Will this customer churn? Is this transaction fraud?ClassificationA category (yes/no, tiers)LOGISTIC_REG, BOOSTED_TREE_CLASSIFIER, RANDOM_FOREST_CLASSIFIER, DNN_CLASSIFIER, AUTOML_CLASSIFIER
How much will this customer spend?RegressionA numberLINEAR_REG, BOOSTED_TREE_REGRESSOR, DNN_REGRESSOR, AUTOML_REGRESSOR
How many units will we sell each day next month?Time-series forecastingPast values over timeARIMA_PLUS, ARIMA_PLUS_XREG
Which customers behave alike?Clustering (unsupervised)NoneKMEANS
Which products should we recommend?RecommendationUser-item interactionsMATRIX_FACTORIZATION
Which readings are unusual?Anomaly detectionNone (or past values)ML.DETECT_ANOMALIES with ARIMA_PLUS, KMEANS, or an autoencoder
Summarize, classify, or extract from text and documentsGenerative AINone (pretrained)Remote models over Gemini (Section 7.4)

The Standard ML Project Lifecycle

The exam guide lists the core stages as data collection, model training, model evaluation, and prediction. A production project wraps them with framing at the start and monitoring at the end:

StageKey decisionsWhere it happens on Google Cloud
1. Frame the problemDefine the label, the prediction moment, and the success metric (for example, recall above 80% on churners)Workshop with the business owner
2. Collect and prepare dataJoin sources, clean values, engineer features, avoid leakageBigQuery SQL, Dataform, Dataflow
3. Split the dataHold out evaluation data; for time-based problems, split by timedata_split_method in CREATE MODEL
4. TrainChoose a model type and optionsCREATE MODEL in BigQuery ML, AutoML, or custom training
5. EvaluateCompare metrics on held-out data with the success metric and a simple baselineML.EVALUATE, ML.CONFUSION_MATRIX, ML.ROC_CURVE
6. Predict (inference)Batch scoring in SQL, or online serving from an endpointML.PREDICT, Model Registry and endpoints (Section 7.3)
7. Monitor and retrainWatch accuracy and input drift; retrain on fresh dataScheduled retraining, model monitoring

Data Leakage

Leakage happens when a training feature contains information that would not exist at prediction time. Predicting whether an order will be returned using refund_issued_date produces excellent evaluation scores and useless real predictions, because a refund date exists only after the return. Build features only from data available at the moment you would make the prediction.

Feature Preparation in BigQuery ML

BigQuery ML automatically one-hot encodes strings, standardizes numbers, and imputes missing values for many model types. For custom logic, the TRANSFORM clause stores preprocessing with the model, so the same steps run again at prediction time:

CREATE OR REPLACE MODEL `customer_analytics.churn_model`
TRANSFORM (
  ML.QUANTILE_BUCKETIZE(tenure_months, 5) OVER () AS tenure_bucket,
  monthly_spend,
  contract_type,
  has_churned
)
OPTIONS (model_type = 'logistic_reg', input_label_cols = ['has_churned']) AS
SELECT tenure_months, monthly_spend, contract_type, has_churned
FROM `customer_analytics.customer_features`;

Choosing the Approach: BigQuery ML, AutoML, Pretrained, or Custom

ApproachWhat you provideStrengthsChoose it when
BigQuery ML built-in modelsSQL and a model typeNo data movement; SQL skills only; fast iterationTabular data already in BigQuery and a standard task (classification, regression, forecasting, clustering)
AutoML through BigQuery ML (AUTOML_CLASSIFIER, AUTOML_REGRESSOR)SQL, a label, and a training budget (BUDGET_HOURS, 1.0 to 72.0, default 1.0)Automatic feature engineering, model search, and hyperparameter tuning on tabular dataYou want the best tabular model with little ML expertise and can accept longer training
AutoML in Vertex AI (Agent Platform)A labeled dataset (tabular, image, or video) in the consoleNo-code training for data types BigQuery ML does not train on, such as labeled images"Classify product photos into categories without writing model code"
Pretrained models and APIs (Gemini, Vision, Translation, Natural Language)Prompts or API calls; no trainingImmediate results for language, documents, and imagesThe task is generic (summarize, translate, extract, classify text)
Custom training (Vertex AI / Agent Platform)Your own TensorFlow, PyTorch, or scikit-learn codeFull control, GPUs and TPUs, any architectureSpecialized models that no managed option covers
-- AutoML from SQL: Google searches models and tunes them within the budget
CREATE OR REPLACE MODEL `customer_analytics.churn_automl`
OPTIONS (
  model_type = 'AUTOML_CLASSIFIER',
  input_label_cols = ['has_churned'],
  budget_hours = 1.0
) AS
SELECT * EXCEPT (customer_id)
FROM `customer_analytics.customer_features`;

Common Exam Traps

  • Exporting tabular data to train elsewhere: For standard models on data already in BigQuery, BigQuery ML avoids data movement and infrastructure.
  • Training on images with BigQuery ML clustering: Labeled image classification calls for AutoML or a pretrained vision model, not KMEANS on raw bytes.
  • Evaluating on training data: Always judge a model on held-out data; a perfect training score often means overfitting or leakage.
  • Using ML when a rule works: Fixed business thresholds belong in SQL, not in a model.
  • Ignoring the label: Supervised models need historical outcomes. With no labels, think clustering, anomaly detection, or a pretrained model.
Test Your Knowledge

A retailer has two years of labeled churn history in BigQuery. Its analysts know SQL but have little ML experience, and they want Google to automatically try feature engineering and model architectures to get the strongest tabular model. Which approach fits best?

A

Train a KMEANS model in BigQuery ML on the customer features and churn column

B

Export the data and write a custom PyTorch model to train on GPUs

C

Call a pretrained Gemini model to label each customer as likely to churn

D

Create a BigQuery ML model with model_type = 'AUTOML_CLASSIFIER'

Test Your Knowledge

A team wants to group customers into segments with similar purchasing behavior. No column describes the segments in advance. Which BigQuery ML model type should they use?

A

LOGISTIC_REG

B

KMEANS

C

LINEAR_REG

D

ARIMA_PLUS

Test Your Knowledge

A model that predicts whether an order will be returned scores 99% on evaluation data but performs poorly once deployed. One of its features is refund_issued_date. What is the most likely problem?

A

Logistic regression cannot use date features, so the model ignored most of its inputs

B

The model needed many more training iterations to converge on stable weights

C

Data leakage: the refund date exists only after a return happens

D

AUTO_SPLIT held out too few evaluation rows to measure accuracy reliably

Sections you finish are checked off in the contents.