The ML.PRINCIPAL_COMPONENTS function

This document describes the ML.PRINCIPAL_COMPONENTS function, which lets you see the principal components of a principal component analysis (PCA) model. Principal components and eigenvectors are the same concepts in PCA models.

Syntax

ML.PRINCIPAL_COMPONENTS(MODEL `project_id.dataset.model`)

Arguments

ML.PRINCIPAL_COMPONENT takes the following arguments:

Output

ML.PRINCIPAL_COMPONENTS returns the following columns:

The output is in descending order by the eigenvalues of the principal components, which you can get by using the ML.PRINCIPAL_COMPONENT_INFO function.

Example

The following example retrieves the principal components from the model mydataset.mymodel in your default project:

SELECT
  *
FROM
  ML.PRINCIPAL_COMPONENTS(MODEL `mydataset.mymodel`)

What's next