BigQuery ML model weights overview
Introduction
A machine learning model is an artifact that is saved after running a machine learning algorithm on training data and represents the rules, numbers, and any other algorithm-specific data structures required to make predictions. Some examples include:
- The linear regression model is comprised of a vector of coefficients with specific values.
- The decision tree model is comprised of a tree or several trees of if-then statements with specific values.
- The deep neural network model is comprised of a graph structure with vectors or matrices of weights with specific values.
In BigQuery ML, the term model weights is used to describe the components comprising a model.
For information about the supported model types of each SQL statement and function, and all of the supported SQL statements and functions for each model type, read the End-to-end user journey for each model.
Model weights offerings in BigQuery ML
BigQuery ML supports multiple functions to retrieve the model weights for different models.
Model category | Model types | Model weights functions | What the function does |
---|---|---|---|
Supervised models | Linear & Logistic Regression | ML.WEIGHTS |
Retrieves the feature coefficients and the intercept. |
Unsupervised models | Kmeans | ML.CENTROIDS |
Retrieves the feature coefficients for all of the centroids. |
Matrix Factorization | ML.WEIGHTS |
Retrieves the weights of all of the latent factors. They represent the two decomposed matrices, the user matrix and the item matrix. | |
PCA | ML.PRINCIPAL_COMPONENTS |
Retrieves the feature coefficients for all principal components, also known as eigenvectors. | |
ML.PRINCIPAL_COMPONENT_INFO |
Retrieves the statistics of each principal component, such as eigenvalue. | ||
Time series models | ARIMA_PLUS | ML.ARIMA_COEFFICIENTS |
Retrieves the coefficients of the ARIMA model, which is used to model the trend component of the input time series. For information about other components such as if there are seasonal patterns present in the time series, use ML.ARIMA_EVALUATE . |
BigQuery ML doesn't support functions that retrieve the weights for boosted trees and random forest models, for TensorFlow models including DNNs, Wide-and-deep and Autoencoder, or for AutoML Tables models. To see the weights of those models, you can export an existing model from BigQuery ML to Cloud Storage and then use the XGBoost library or the TensorFlow library to visualize the tree structure for the tree models or the graph structure for the neural networks. For details, see the EXPORT MODEL
syntax and the EXPORT MODEL
tutorial.