dlpy.model.Model.forecast¶
-
Model.
forecast
(test_table=None, horizon=1, train_table=None, layer_out=None, layers=None, gpu=None, buffer_size=10, mini_batch_buf_size=None, use_best_weights=False, n_threads=None, casout=None)¶ Make forecasts based on deep learning models trained on TimeseriesTable.
This method performs either one-step-ahead forecasting or multi-step-ahead forecasting determined by the horizon parameter. If the model is autoregressive (the value of the response variable depends on its values at earlier time steps), it performs one-step-ahead forecasting recursively to achieve multi-step-ahead forecasting. More specifically, the predicted value at the previous time step is inserted into the input vector for predicting the next time step.
Parameters: - test_table : string or CASTable, optional
Specifies the test table. If test_table=None, the model cannot have additional static covariates or predictor timeseries, and can only be a autoregressive model. In this case, the forecast extends the timeseries from the last timestamp found in the training/validation set. If the model contains additional static covariates or predictor timeseries (that are available for predicting the target timeseries), the test table has to be provided, and the forecast starts from the first timestamp in the test data. If the model is autoregressive, and the test data columns do not include all the required preceeding time points of the target series (the lagged target variables), the forecast will be extended from the last time timestamp in training/validation set and only use the static covariates or predictor timeseries information from the test data if they are available for the corresponding time points. Default : None
- horizon : int, optional.
Specifies the forecasting horizon. If horizon=1 and test data is provided, it will make one-step-ahead forecasts for all timestamps in the test data.(given the test data has all the columns required to make prediction.) Otherwise, it will only make one forecasted series per by-group, with the length specified by the horizon parameter. Default : 1
- train_table : TimeseriesTable, optional.
If model has been fitted with a TimeseriesTable, this argument is ignored. Otherwise, this argument is required, and reference to the TimeseriesTable used for model training, as it contains information regarding when to extend the forecast from, and sequence length etc.
- layer_out : string, optional
Specifies the settings for an output table that includes layer output values. By default, all layers are included. You can filter the list with the layers parameter.
- layers : list of strings
Specifies the names of the layers to include in the output layers table.
- gpu : Gpu, optional
When specified, the action uses graphical processing unit hardware. The simplest way to use GPU processing is to specify “gpu=1”. In this case, the default values of other GPU parameters are used. Setting gpu=1 enables all available GPU devices for use. Setting gpu=0 disables GPU processing.
- buffer_size : int, optional
Specifies the number of observations to score in a single batch. Larger values use more memory.
Default: 10- mini_batch_buf_size : int, optional
Specifies the size of a buffer that is used to save input data and intermediate calculations. By default, each layer allocates an input buffer that is equal to the number of input channels multiplied by the input feature map size multiplied by the bufferSize value. You can reduce memory usage by specifying a value that is smaller than the bufferSize. The only disadvantage to specifying a small value is that run time can increase because multiple smaller matrices must be multiplied instead of a single large matrix multiply.
- use_best_weights : bool, optional
When set to True, the weights that provides the smallest loss error saved during a previous training is used while scoring input data rather than the final weights from the training.
Default: False- n_threads : int, optional
Specifies the number of threads to use. If nothing is set then all of the cores available in the machine(s) will be used.
- casout : dict or CASTable, optional
If it is dict, it specifies the output CASTable parameters. If it is CASTable, it is the CASTable that will be overwritten. None means a new CASTable with random name will be generated.
Default: None
Returns: - CASTable