The ML.GLOBAL_EXPLAIN function

This document describes the ML.GLOBAL_EXPLAIN function, which lets you provide explanations for the entire model by aggregating the local explanations of the evaluation data. You can only use ML.GLOBAL_EXPLAIN with models that are trained with the ENABLE_GLOBAL_EXPLAIN option set to TRUE.

Syntax

ML.GLOBAL_EXPLAIN(
  MODEL `project_id.dataset.model_name`,
  STRUCT(
    [class_level_explain AS class_level_explain]))

Arguments

ML.GLOBAL_EXPLAIN takes the following arguments:

Output

The output of ML.GLOBAL_EXPLAIN has two formats:

Examples

The following examples assume your model is in your default project.

Regression model

This example gets global feature importance for the boosted tree regression model mymodel in mydataset. The dataset is in your default project.

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

Classifier model

This example gets global feature importance for the boosted tree classifier model mymodel in mydataset. The dataset is in your default project.

SELECT
  *
FROM
  ML.GLOBAL_EXPLAIN(MODEL `mydataset.mymodel`, STRUCT(TRUE AS class_level_explain))

What's next