hanaml.LTSF.Rd
hanaml.LTSF is a R wrapper for SAP HANA PAL Long-Term Series Forecasting (LTSF).
hanaml.LTSF(
data = NULL,
key = NULL,
endog = NULL,
exog = NULL,
train.length = NULL,
forecast.length = NULL,
num.levels = NULL,
kernel.size = NULL,
hidden.expansion = NULL,
batch.size = NULL,
num.epochs = NULL,
random.seed = NULL,
position.encoding = NULL,
adjust.learning.rate = NULL,
learning.rate = NULL,
dropout.prob = NULL,
model = NULL,
warm.start = FALSE
)
DataFrame
DataFrame containting the data.
character, optional
Name of the ID column.
If not provided, the data is assumed to have no ID column.
No default value.
character, optional
The endogenous variable, i.e. time series.
Defaults to the first non-ID column.
character or list of characters, optional
An optional array of exogenous variables.
Defaults to NULL.
integer
Length of training series inputted to the network.
Note when warm.start = TRUE, this parameter is not valid.
integer
Length of predictions.
Note when warm.start = TRUE, this parameter is not valid.
integer, optional
Number of levels in the network architecture.
Note when warm.start = TRUE, this parameter is not valid.
Defaults to 2.
integer, optional
Kernel size of Conv1d layer.
Note when warm.start = TRUE, this parameter is not valid.
Defaults to 3.
integer, optional
NExpands the input channel size of Conv1d layer.
Note when warm.start = TRUE, this parameter is not valid.
Defaults to 3.
integer, optional
Number of pieces of data for training in one iteration.
Defaults to 8.
integer, optional
Number of training epochs.
Defaults to 1.
integer, optional
0 indicates using machine time as seed.
Defaults to 0.
logical, optional
Position encoding adds extra positional embeddings to the training series.
- FALSE: Do not use.
- TRUE: Use.
Defaults to TRUE.
logical, optional
Decays the learning rate to its half after every epoch.
- FALSE: Do not use.
- TRUE: Use.
Defaults to TRUE.
numeric, optional
Initinal learning rate for Adam optimizer.
Defaults to 0.005.
numeric, optional
Dropout probability of Dropout layer.
Defaults to 0.05.
DataFrame, optional
The model used for warm start.
Defaults to NULL.
logical, optional
When set to TRUE, use the input model to train the provided model with new input data.
If no model is provided, an error will be prompted.
Defaults to FALSE.
Returns an R6 object of class "LTSF", with following attributes and methods:
Attributes
loss: DataFrame
Indicates the information of training loss either batch ID or average batch loss indicator.
model: DataFrame
Trained model content.
Although traditional algorithms are capable of predicting values in the near future, their performance will deteriorate greatly when it comes to long-term series forecasting. With the help of deep learning, this function implements a novel neural network architecture to achieve the state-of-the-art performance among the PAL family.
Input dataframe is df.fit and invoke hanaml.LTSF():
> lt1 <- hanaml.LTSF(data=df.fit,
train.length=32,
forecast.length=16,
key="TIME_STAMP",
endog="TARGET",
exog=list("FEAT1", "FEAT2", "FEAT3", "FEAT4"),
num.levels=2,
kernel.size=3,
hidden.expansion=3,
batch.size=8,
num.epochs=2,
position.encoding=TRUE,
adjust.learning.rate=TRUE,
learning.rate=0.005,
dropout.prob=0.2,
random.seed=1)
Output:
> print(lt1$loss$Collect())
> print(lt1$model$Collect())
We also provide the continuous training with new training data which uses a parameter warm.start to control. Please provide a trained model when invoke hanaml.LTSF().
> lt2 <- hanaml.LTSF(df.fit2,
key="TIME_STAMP",
endog="TARGET",
exog=list("FEAT1", "FEAT2", "FEAT3", "FEAT4"),
num.epochs=1,
dropout.prob=0.2,
learning.rate=0.002,
model=lt1$model,
warm.start=TRUE)
Output:
> print(lt2$loss$Collect())
> print(lt2$model$Collect())