developer wokring on bigquery ml
Machine Learning

What Is BigQuery ML?

September 5, 2023

Google Cloud tools like BigQuery ML are used by major healthcare companies to analyze data and improve healthcare processes, according to CEO Sundar Pichai. With such diverse use, this tool has to be powerful enough to fit your company and its needs, right?

Well, the answer to that is ultimately up to you, but we are here to help you understand what this platform can do, and even how you might be able to integrate it into analyzing your own data.

Read on to learn everything you need to know about BigQuery ML.

What Is BigQuery ML?

Put simply, BigQuery ML allows you to execute machine learning (ML) models inside Google Cloud's BigQuery. Using standard SQL queries, BigQuery ML optimizes workflow by eliminating the need to move data between programs.

You can access this program through Google Cloud, BigQuery Rest API, or an external tool like Jupyter Notebook or a business intelligence platform.

Key Features of BigQuery ML

Not only does this tool allow users to train ML models without needing any knowledge of languages like Python, but it can also generate ML models automatically. This feature is called AutoML and is meant to provide amateur users with expert-level models to help you communicate your datasets.

It also provides access to a user-friendly graphic interface that makes building your models that much easier. You can also encrypt your ML models with customer-managed encryption keys (CMEK).

Before BigQuery ML, you had to move data from BigQuery to other platforms in order to train your model. Now, you can train and execute your models from the BigQuery console.

Lastly, you can even export your ML models for online prediction into Vertex AI, or your own serving layer. BigQuery ML also supports other models.

What ML Models Are Supported?

Here are a few of the ML models:

  • Time Series
  • K-Means Clustering
  • Matrix Factorization
  • Logistic Regression: Binary and Multiclass
  • Linear Regression
  • Boosted Tree
  • Deep Neural Network
  • AutoML Tables
  • TensorFlow model importing
  • Autoencoder

If you're using BigQuery ML as a novice, Linear Regression might be the best model to start with. It's best for forecasting data, like sales of an item or service on a given day.

Logistic Regression is best for classification and comes with two options: Binary and Multiclass. Binary is used when the required input only has two outcomes (like yes and no), while Multiclass can have multiple.

K-Means Clustering is used for data segmentation. It's an unsupervised learning technique, so it doesn't require labels or split data.

Matrix Factorization allows you to create product recommendation systems using things like historical customer behavior, transactions, and even product ratings. Finally, Time Series is used to give forecasts on time-series data, and the model automatically handles anomalies, seasonality, and even holidays.

If you'd like to learn more about the ML models the console supports, you can go here.

Pros and Cons of BigQuery ML

While BigQuery is a powerful program and comes with plenty of great features, nothing is perfect. Here are a few pros and cons:


We've touched on this a bit already, but it's worth mentioning again. You don't have to know or use programming languages like R or Python to create and use models in this program. That saves you time on its own, but you also save time by removing the need to export your data from BigQuery.

You also save time (and therefore money) on quick, baseline models you might need access to.


Though you can have access to a model quickly, it isn't going to be very high-quality. You're likely to need other tools to complete your model all the way through if you're looking for something custom and nice-looking.

The cost can also run a little high if you go over the free quota, which is very likely. ML models often need to be trained several times before they're complete, and you'll end up paying each time you need to make changes.

Best Practices for BigQuery ML

There's really only one common pitfall that comes from using BigQuery ML, and that's overfitting. Overfitting occurs when you're creating a model that matches the training data too closely, preventing it from performing well. BigQuery ML offers two methods for preventing this: early stopping and regularization.

Early Stopping

This is going to be your default option. When early stopping is enabled, the console monitors the loss of the holdout data during training. It's halted once the loss improvement falls below a certain threshold.

Since that data isn't used during training, you're given a good estimate of the model's loss on new data.


This keeps the model weights from getting too large, and therefore training data too closely. BigQuery ML supports two methods for controlling the size of the model weights: L1 regularization and L2 regularization.

If you find yourself experimenting with these parameters, try disabling early stopping so the effect of regularization is obvious. If you have a large number of features compared to the size of the training set, then you should try large values for the regularization parameters. The risk of overfitting becomes greater when there are only a few observations per feature.

Is BigQuery ML Right for You?

With so much to offer, BigQuery ML is a valuable addition to any developer's toolbelt. The question is, is it the right program for you and your business?

If you're looking to have that question answered, Bitstrapped is here to help. Our team of experts can help you learn all about programs, and even how those programs (like BigQuery ML) can be applied to your business.

Contact us today to book a discovery call and to begin working towards the perfect ML model for you and your business.

Article By