The ML.RECONSTRUCTION_LOSS function
This document describes the ML.RECONSTRUCTION_LOSS
function, which you can use
to compute the reconstruction losses between the input and output data of an
autoencoder model.
Syntax
ML.RECONSTRUCTION_LOSS( MODEL `project_id.dataset.model`, { TABLE `project_id.dataset.table_name` | (query_statement) } )
Arguments
ML.RECONSTRUCTION_LOSS
takes the following arguments:
project_id
: Your project ID.dataset
: The BigQuery dataset that contains the model.model
: The name of the model.table
: The name of the input data table.If you specify
table_name
, the input column names in the table must match the column names in the model, and their types must be compatible according to BigQuery implicit coercion rules.query_statement
: The GoogleSQL query to use for input data to generate the reconstruction losses. For the supported SQL syntax of thequery_statement
clause in GoogleSQL, see Query syntax.If you specify
query_statement
, the input column names from the query must match the column names in the model, and their types must be compatible according to BigQuery implicit coercion rules.If you used the
TRANSFORM
clause in theCREATE MODEL
statement that created the model, then you can only use the input columns present in theTRANSFORM
clause in thequery_statement
.
Output
ML.RECONSTRUCTION_LOSS
returns the following columns:
mean_absolute_error
: aFLOAT64
value that contains the mean absolute error for the model.mean_squared_error
: aFLOAT64
value that contains the mean squared error for the model.mean_squared_log_error
: aFLOAT64
value that contains the mean squared log error for the model.
Limitations
ML.RECONSTRUCTION_LOSS
doesn't support
imported TensorFlow models.
Example
The following query computes reconstruction losses for the model
mydataset.mymodel
in your default project:
SELECT * FROM ML.RECONSTRUCTION_LOSS( MODEL `mydataset.mymodel`, (SELECT column1, column2, column3, column4 FROM `mydataset.mytable`) )
What's next
- For information about model evaluation, see BigQuery ML model evaluation overview.
- For information about the supported SQL statements and functions for each model type, see End-to-end user journey for each model.