TSLSTM
TSLSTM
R topics documented:
ts.lstm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Index 4
1
2 ts.lstm
ts.lstm Long Short Term Memory (LSTM) Model for Time Series Forecasting
Description
The LSTM (Long Short-Term Memory) model is a Recurrent Neural Network (RNN) based archi-
tecture that is widely used for time series forecasting. Min-Max transformation has been used for
data preparation. Here, we have used one LSTM layer as a simple LSTM model and a Dense layer
is used as the output layer. Then, compile the model using the loss function, optimizer and metrics.
This package is based on Keras and TensorFlow modules.
Usage
ts.lstm(
ts,
xreg = NULL,
tsLag,
xregLag = 0,
LSTMUnits,
DropoutRate = 0,
Epochs = 10,
CompLoss = "mse",
CompMetrics = "mae",
ActivationFn = "tanh",
SplitRatio = 0.8,
ValidationSplit = 0.1
)
Arguments
ts Time series data
xreg Exogenous variables
tsLag Lag of time series data
xregLag Lag of exogenous variables
LSTMUnits Number of unit in LSTM layer
DropoutRate Dropout rate
Epochs Number of epochs
CompLoss Loss function
CompMetrics Metrics
ActivationFn Activation function
SplitRatio Training and testing data split ratio
ValidationSplit
Validation split ration
ts.lstm 3
Value
• TrainFittedValue: Fitted value of train data
• TestPredictedValue: Predicted value of test data
• AccuracyTable: RMSE and MAPE of train and test data
References
Paul, R.K. and Garai, S. (2021). Performance comparison of wavelets-based machine learning
technique for forecasting agricultural commodity prices, Soft Computing, 25(20), 12857-12873
Examples
y<-rnorm(100,mean=100,sd=50)
x1<-rnorm(100,mean=50,sd=50)
x2<-rnorm(100, mean=50, sd=25)
x<-cbind(x1,x2)
TSLSTM<-ts.lstm(ts=y,xreg = x,tsLag=2,xregLag = 0,LSTMUnits=5, Epochs=2)
Index
ts.lstm, 2