Documentation Home
HeatWave User Guide
Related Documentation Download this Manual
PDF (US Ltr) - 2.0Mb
PDF (A4) - 2.0Mb


HeatWave User Guide  /  ...  /  Using Forecasting Models with Prediction Intervals

3.9.3.1 Using Forecasting Models with Prediction Intervals

Before You Begin
Using Prediction Intervals

To use a forecasting model with prediction intervals:

  1. Use the ML_MODEL_LOAD routine to load the forecasting model:

    mysql> CALL sys.ML_MODEL_LOAD(@forecast_model, NULL);
  2. Use the ML_PREDICT_TABLE routine to generate forecasting predictions with prediction intervals:

    mysql> CALL sys.ML_PREDICT_TABLE('schema_name.`input_table_name`', @forecast_model, 'schema_name.`output_table_name`',
    JSON_OBJECT('prediction_interval', 0.95));

    Where:

    • schema_name is the database name that contains the table. Update this with the appropriate database.

    • `input_table_name` is the input table that contains the training dataset. Update this with the appropriate input table.

    • @forecast_model is the session variable that contains the model handle. Update this as needed.

    • `output_table_name` is the output table that will have the predictions. No existing table can have the same name.

    • JSON_OBJECT('prediction_interval', 0.95) includes the prediction interval option at 95% certainty.

For every endogenous variable included in the trained forecasting model, prediction_interval_EndogVar is added to the ml_results JSON. EndogVar is the endogenous variable name. The lower and upper bounds are also included.

See the following example:

mysql> select ml_results from schema_name.output_table_name limit 1;
+---------------------------------------------------------------------------------------------------------------------------------------------+
| ml_results                                                                                                                                  |
+---------------------------------------------------------------------------------------------------------------------------------------------+
| {"predictions": {"C1": 616.911, "C2": 456.851, "prediction_interval_C1": [250.507, 850.329], "prediction_interval_C2": [150.461, 750.164]}} |
+---------------------------------------------------------------------------------------------------------------------------------------------+

Where:

  • C1 is the first endogenous variable, and C2 is the second endogenous variable.

  • The lower and upper bounds for C1 are 250.507 and 850.329.

  • The lower and upper bounds for C2 are 150.461 and 750.164.