The ML.RECONSTRUCTION_LOSS function

This document describes theML.RECONSTRUCTION_LOSS function, which you can useto compute the reconstruction losses between the input and output data of anautoencoder model.

Syntax

ML.RECONSTRUCTION_LOSS(  MODEL `PROJECT_ID.DATASET.MODEL_NAME`,  { TABLE `PROJECT_ID.DATASET.TABLE` | (QUERY_STATEMENT) })

Arguments

ML.RECONSTRUCTION_LOSS takes the following arguments:

  • PROJECT_ID: the project that contains theresource.
  • DATASET: the dataset that contains theresource.
  • MODEL: the name of the model.
  • TABLE: the name of the input data table.

    If you specifyTABLE, the input column names in the table must matchthe column names in the model, and their types must be compatible according toBigQueryimplicit coercion rules.

  • QUERY_STATEMENT: the GoogleSQLquery to use for input data to generate the reconstruction losses. Forthe supported SQL syntax of theQUERY_STATEMENT clause inGoogleSQL, seeQuery syntax.

    If you specifyQUERY_STATEMENT, the input column names from the query mustmatch the column names in the model, and their types must be compatibleaccording to BigQueryimplicit coercion rules.

    If you used theTRANSFORM clausein theCREATE MODEL statement that created the model,then you can only use the input columns present in theTRANSFORM clausein theQUERY_STATEMENT.

Output

ML.RECONSTRUCTION_LOSS returns the following columns:

  • mean_absolute_error: aFLOAT64 value that contains themean absolute error forthe model.
  • mean_squared_error: aFLOAT64 value that contains themean squared error forthe model.
  • mean_squared_log_error: aFLOAT64 value that contains the mean squaredlog error for the model.

Limitations

ML.RECONSTRUCTION_LOSS doesn't supportimported TensorFlow models.

Example

The following query computes reconstruction losses for the modelmydataset.mymodel in your default project:

SELECT*FROMML.RECONSTRUCTION_LOSS(MODEL`mydataset.mymodel`,(SELECTcolumn1,column2,column3,column4FROM`mydataset.mytable`))

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.