The ML.RECONSTRUCTION_LOSS function
Use the ML.RECONSTRUCTION_LOSS
function to compute the reconstruction losses
between the input and output data of an
Autoencoder
model.
For information about model inference in BigQuery ML, see Model inference 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.RECONSTRUCTION_LOSS
syntax
ML.RECONSTRUCTION_LOSS( MODEL model_name, {TABLE table_name | (query_statement)} )
model_name
model_name
is the name of the Autoencoder model you have trained. 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`.
table_name
table_name
is the name of the input data table before feeding it into the
Autoencoder model. If you do not have a default project configured, prepend the
project ID to the table name in following format: `[PROJECT_ID].[DATASET].[TABLE]`
(including the backticks). For example, `myproject.mydataset.mytable`.
If table_name
is specified, 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.
If table_name
is not specified, a query_statement
is required as the input
data for ML.RECONSTRUCTION_LOSS
.
query_statement
(Optional) The query_statement
clause specifies the GoogleSQL query that is
used as the input data to generate the reconstruction losses. See
GoogleSQL Query Syntax
for more information about the supported SQL syntax of the query_statement
clause.
If query_statement
is specified, the input column names from the query must
match the column names in the model, and their types should be compatible
according to BigQuery implicit coercion rules.
If the TRANSFORM
clause was present in the CREATE MODEL
statement that created model_name
,
then only the input columns present in the TRANSFORM
clause must appear in query_statement
.
ML.RECONSTRUCTION_LOSS
output
The output of the ML.RECONSTRUCTION_LOSS
function is a single row containing common
metrics applicable to the type of model supplied.
ML.RECONSTRUCTION_LOSS
returns the following columns for an Autoencoder model:
mean_absolute_error
mean_squared_error
mean_squared_log_error
ML.RECONSTRUCTION_LOSS
limitations
The ML.RECONSTRUCTION_LOSS
function is subject to the following limitations:
ML.RECONSTRUCTION_LOSS
does not support imported TensorFlow models.
ML.RECONSTRUCTION_LOSS
example
The following query computes reconstruction losses using a model and specifying input data.
SELECT * FROM ML.RECONSTRUCTION_LOSS( MODEL `mydataset.mymodel`, (SELECT column1, column2, column3, column4 FROM `mydataset.mytable`) )