The function used to make predictions using a model in BigQuery ML is called `ML.PREDICT`. BigQuery ML is a powerful tool provided by Google Cloud Platform that allows users to build and deploy machine learning models using standard SQL. With the `ML.PREDICT` function, users can apply their trained models to new data and generate predictions.
To use the `ML.PREDICT` function, you need to have a trained model in BigQuery ML. This can be achieved by using the `CREATE MODEL` statement, which trains a model on a specified dataset. Once the model is trained, you can use the `ML.PREDICT` function to make predictions.
The syntax for the `ML.PREDICT` function is as follows:
SELECT
predicted_column,
[predicted_columns...]
FROM
ML.PREDICT(MODEL `project_id.dataset.model`, (
SELECT
input_column,
[input_columns...]
FROM
`project_id.dataset.table`
))
In this syntax, `predicted_column` refers to the column(s) in the output that will contain the predicted values. These columns should match the schema of the trained model. The `input_column` refers to the column(s) in the input data that will be used for making predictions. These columns should match the schema of the training data.
Here is an example to illustrate the usage of the `ML.PREDICT` function:
SELECT
predicted_label,
predicted_probabilities
FROM
ML.PREDICT(MODEL `myproject.mydataset.mymodel`, (
SELECT
sepal_length,
sepal_width,
petal_length,
petal_width
FROM
`myproject.mydataset.mytable`
))
In this example, the trained model is specified as `myproject.mydataset.mymodel`, and the input data is selected from `myproject.mydataset.mytable`. The output includes the predicted label and the predicted probabilities.
The `ML.PREDICT` function is a valuable tool in BigQuery ML as it allows users to easily apply their trained models to new data and obtain predictions. By incorporating this function into their workflows, users can leverage the power of machine learning in BigQuery and make accurate predictions based on their trained models.
The `ML.PREDICT` function in BigQuery ML is used to make predictions using a trained model. It takes the trained model and new input data as parameters and returns the predicted values based on the model's learned patterns. By utilizing this function, users can effectively apply their models to new data and obtain valuable predictions.
Other recent questions and answers regarding Examination review:
- How can you check the training statistics of a model in BigQuery ML?
- What is the purpose of the create model statement in BigQuery ML?
- How can you access BigQuery ML?
- What are the three types of machine learning models supported by BigQuery ML?

