The ML.FEATURE_INFO function

ML.FEATURE_INFO function

The ML.FEATURE_INFO function allows you to see information about the input features used to train a model.

For information about feature preprocessing support in BigQuery ML, see Feature preprocessing overview.

For information about supported model types of each SQL statement and function, and all supported SQL statements and functions for each model type, read End-to-end user journey for each model.

ML.FEATURE_INFO syntax

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

Where:

  • project_id is your project ID.
  • dataset is the BigQuery dataset that contains the model.
  • model is the name of the model.

ML.FEATURE_INFO output

ML.FEATURE_INFO returns the following columns:

  • input — The name of the column in the input training data.
  • min — The sample minimum. This column is NULL for non-numeric inputs.
  • max — The sample maximum. This column is NULL for non-numeric inputs.
  • mean — The average. This column is NULL for non-numeric inputs.
  • stddev — The standard deviation. This column is NULL for non-numeric inputs.
  • category_count — The number of categories. This column is NULL for non-categorical columns.
  • null_count — The number of NULLs.

If the TRANSFORM clause was present in the CREATE MODEL statement that created model, ML.FEATURE_INFO outputs the information of the pre-transform columns from query_statement.

ML.FEATURE_INFO permissions

Both bigquery.models.create and bigquery.models.getData are required to run ML.FEATURE_INFO.

For matrix factorization models, only the category_count is calculated for the user and item columns.

ML.FEATURE_INFO example

The following example retrieves feature information from mymodel in mydataset. The dataset is in your default project.

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

ML.FEATURE_INFO limitations

The ML.FEATURE_INFO function is subject to the following limitations: