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
, andYEAR
, 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 thetarget_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 includeexogenous_variables
.
See Section 3.5, “Training a Model”, and for full details
of all the options
, see
ML_TRAIN
.
-
An
ML_TRAIN
example that specifies theforecasting
task type and the additional required parametersdatetime_index
andendogenous_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 theOrbitForecaster
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 theOrbitForecaster
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);