MySQL 9.3 Reference Manual Including MySQL NDB Cluster 9.3
This class encapsulates the forecasting task as described in
Forecasting.
Forecaster
supports methods for loading,
training, and unloading models, predicting labels, and related
tasks.
Each instance of Forecaster
has three
accessible properties, listed here:
metadata
(Object
):
Model metadata stored in the model catalog. See
Model Metadata.
trainOptions
(Object
):
The training options that were specified in the constructor
when creating this instance.
You can obtain an instance of Forecaster
by
invoking its constructor, shown here:
Signature
new ml.Forecaster( Stringname
[, ObjecttrainOptions
] )
Arguments
name
(String
): Unique identifier for this
Forecaster
.
trainOptions
(Object
)
(optional): Training options; these
are the same as the training options used with
sys.ML_TRAIN
.
Return type
An instance of Forecaster
.
Trains and loads a new forecast. This method acts as a wrapper
for both sys.ML_TRAIN
and
sys.ML_MODEL_LOAD
, but is
specific to HeatWave AutoML forecasting.
Signature
Forecaster.train( TabletrainData
, Stringindex
, Array[String]endogenousVariables
[, Array[String]exogenousVariables
] )
Arguments
trainData
(Table
): A
Table
containing a
training dataset. The table must not take up more than 10
GB space, or hold more than 100 million rows or more than
1017 columns.
index
(String
): Name of the target column
containing ground truth values. This must not be a
TEXT
column.
endogenousVariables
(Array[String]
): The name or names of
the column or columns to be forecast.
exogenousVariables
(Array[String]
): The name or names of
the column or columns of independent, predictive
variables, and have not been forecast.
Return type
Does not return a value. After invoking this method, you
can observe its effects by selecting from the
MODEL_CATALOG
and
model_object_catalog
tables, as
described in
the examples
provided in the HeatWave documentation.
An alias for
train()
, and
identical to it in all respects save the method name. See
Forecaster.train(), for more
information.
This method predicts labels, and has two variants, one of
which predicts labels from data found in the indicated table
and stores them in an output table; this variant of
predict()
acts as a JavaScript wrapper for
sys.ML_PREDICT_TABLE
. The other
variant of this method is a wrapper for
sys.ML_PREDICT_ROW
, and
predicts a label for a single set of sample data and returns
it to the caller. Both versions are shown here.
Predicts labels, saving them in the output table specified by the user.
Signature
Forecaster.predict( TabletestData
, TableoutputTable
[, Objectoptions
] )
Arguments
testData
(Table
): Table
containing test data.
outputTable
(Table
): Table in which to store
labels. The output written to the table uses the same
content and format as that generated by the AutoML
ML_PREDICT_TABLE
routine.
options
(Object
)
(optional): Set of options in JSON
format. For more information, see
ML_PREDICT_TABLE.
Return type
None. (Inserts into a target table.)
Predicts a label for a single sample of data, and returns it. See ML_PREDICT_ROW, for more information about type and format of the value returned.
Signature
String Forecaster.predict(
Object sample
)
Arguments
sample
(Object
): Sample data containing
members that were used for training; extra members may be
included but are ignored during prediction.
Return type
String
. See the documentation for
ML_PREDICT_ROW
for details.
Returns the score for the test data in the indicated table and column, using the specified metric. For possible metric values and their effects, see Optimization and Scoring Metrics.
score()
is a JavaScript wrapper for
sys.ML_SCORE
.
Signature
score( TabletestData
, StringtargetColumnName
, Stringmetric
[, Objectoptions
] )
Arguments
testData
(Table
): Table which
contains the test data. The table must contain the same
columns as the training dataset.
targetColumnName
(String
): Name of the target column
containing ground truth values.
metric
(String
): Name of the scoring metric.
See Optimization and Scoring Metrics, for
information about metrics which can be used for HeatWave AutoML
forecasting.
options
(Object
)
(optional): A set of options in JSON
key-value format. For more information, see
ML_SCORE.
Return type
Number
.
Unloads the model. This method is a wrapper for
sys.ML_MODEL_UNLOAD
; see the
description of this routine in the HeatWave AutoML documentation
for more information.
Signature
Forecaster.unload()
Arguments
None.
Return type
None.