The ML.TRIAL_INFO function

The ML.TRIAL_INFO function is used to display information regarding trials from a hyperparameter tuning model.

For information about BigQuery ML hyperparameter tuning, see Hyperparameter tuning 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.TRIAL_INFO syntax

ML.TRIAL_INFO(MODEL model_name)

model_name

model_name is the name of the model you're evaluating. If you do not have a default project configured, prepend the project ID to the model name in following format: \`[PROJECT_ID].[DATASET].[MODEL]\` (including the backticks); for example, `myproject.mydataset.mymodel`.

This statement returns in one row per trial with the following columns:

  • trial_id (int64_value): 1-based ID assigned to each trial in the approximate order of trial execution.
  • hyperparameters (STRUCT): The hyperparameters used in each trial contained in a STRUCT.
  • hparam_tuning_evaluation_metrics (STRUCT): The evaluation metrics specified by hparam_tuning_objectives. Metrics are calculated from the evaluation data. See data split section for a comparison of evaluation and test data.
  • training_loss (float64_value): The loss of the trial during the last iteration calculated using the training data.
  • eval_loss (float64_value): The loss of the trial during the last iteration calculated using the evaluation data.
  • status (string_value): The final status of the trial:
    • SUCCEEDED: The trial succeeded.
    • FAILED: The trial failed.
    • INFEASIBLE: The trial was not run due to an invalid combination of hyperparameters.
  • error_message (string_value): The error message if the trial did not succeed. See hyperparameter tuning error handling for more information.
  • is_optimal (bool_value): Whether the trial had the best objective value. If multiple trials are marked as optimal, then the trial with the smallest trial_id as the default trial during model serving is used.

ML.TRIAL_INFO example

The following query retrieves information of all trials from mymodel in mydataset, under myproject.

SELECT
  *
FROM
  ML.TRIAL_INFO(MODEL `myproject.mydataset.mymodel`)