ML.PRINCIPAL_COMPONENT_INFO function lets you see the statistics of each
principal component, such as eigenvalue and explained variance ratio. This function only applies to the PCA models.
For information about model weights support in BigQuery ML, see Model weights overview.
For information about the supported model types of each SQL statement and function, and for a list of all of the supported SQL statements and functions for each model type, read End-to-end user journey for each model.
project_id: your project ID
dataset: the BigQuery dataset that contains the model
model: the name of the model
ML.PRINCIPAL_COMPONENT_INFO function returns the following columns:
- principal_component_id: an integer that identifies the principal component. The table is ordered in the descending order of the eigenvalues.
- eigenvalue: the factor by which the eigenvector is scaled. Eigenvalue and explained variance are the same concepts in PCA.
- explained_variance_ratio: the total variance is the sum of variances, also known as eigenvalues, of all of the individual principal components. The explained variance ratio by a principal component is the ratio between the variance, also known as eigenvalue, of that principal component and the total variance.
- cumulative_explained_variance_ratio: cumulative_explained_variance_ratio of the k-th principal component is the sum of explained variance ratios of all its previous principal components, including k-th principal component.
The following example retrieves the eigenvalue related information of each
principal component in
mydataset. The dataset is in your default
SELECT * FROM ML.PRINCIPAL_COMPONENT_INFO(MODEL `mydataset.mymodel`)