Using the time series forecasting model
To use our BigQuery ML model, we'll use the ML.FORECAST
function to specify the parameters for the prediction.
The query will extract all the fields produced by the forecast function that accepts the following parameters:
- The model name,
`08_sales_forecasting.liquor_forecasting`
, preceded by the keywordMODEL
. - A
STRUCT
that includes thehorizon
of the forecast:30
days and theconfidence_level
chosen for the prediction – in this case, 80%:SELECT   * FROM   ML.FORECAST(MODEL `08_sales_forecasting.liquor_forecasting`,               STRUCT(30 AS horizon, 0.8 AS confidence_level));
The execution of the query generates the records shown in the following screenshot:
We can notice in Figure 8.14 that the predictions are chronologically...