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


HeatWave User Guide  /  ...  /  Training a Forecasting Model

3.9.2 Training a Forecasting Model

Run the ML_TRAIN routine to create a forecasting model, and use the following JSON options:

ML_TRAIN does not require target_column_name for forecasting, and it can be set to NULL.

  • task: forecasting: Specifies the machine learning task.

  • datetime_index: 'column' The column name for a datetime column that acts as an index for the forecast variable. The column can be one of the supported datetime column types, DATETIME, TIMESTAMP, DATE, TIME, and YEAR, or an auto-incrementing index.

  • endogenous_variables: JSON_ARRAY('column1','column2' ...) The column or columns to be forecast. One of these columns must also be specified as the target_column_name.

  • exogenous_variables: JSON_ARRAY('column1','column2' ...) The column or columns of independent, non-forecast, predictive variables. For example, for sales forecasting these variables might be advertising expenditure, occurrence of promotional events, weather, or holidays.

  • model_list: JSON_ARRAY('model1','model2' ...) Used to specify which supported models to consider during the algorithm selection stage. See Forecasting Models.

  • include_column_list: JSON_ARRAY('column1','column2' ...) include_column_list can include exogenous_variables.

See Section 3.5, “Training a Model”, and for full details of all the options, see ML_TRAIN.

Syntax Examples

  • An ML_TRAIN example that specifies the forecasting task type and the additional required parameters datetime_index and endogenous_variables:

    mysql> CALL sys.ML_TRAIN('ml_data.opsd_germany_daily_train', 'consumption', 
              JSON_OBJECT('task', 'forecasting', 'datetime_index', 'ddate', 
              'endogenous_variables', JSON_ARRAY('consumption')), 
              @forecast_model);

  • An ML_TRAIN example that specifies the OrbitForecaster model with exogenous variables.

    mysql> CALL sys.ML_TRAIN('mlcorpus.opsd_germany_daily_train', NULL, JSON_OBJECT('task', 'forecasting', 'datetime_index', 'ddate', 'endogenous_variables', 
      JSON_ARRAY('consumption'), 'exogenous_variables', JSON_ARRAY('wind', 'solar', 'wind_solar'), 'model_list', JSON_ARRAY('OrbitForecaster')), @model);

  • An ML_TRAIN example that specifies the OrbitForecaster model without exogenous variables.

    mysql> CALL sys.ML_TRAIN('mlcorpus.`datetime_train`', 'C1', JSON_OBJECT('task', 'forecasting', 'datetime_index', 'C0', 
      'endogenous_variables', JSON_ARRAY('C1'), 'model_list', JSON_ARRAY('OrbitForecaster')), @datetime_model);