Title: | 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 architecture 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 and the algorithm of Paul and Garai (2021) <doi:10.1007/s00500-021-06087-4>. |
Authors: | Dr. Ranjit Kumar Paul [aut, cre], Dr. Md Yeasin [aut] |
Maintainer: | Dr. Ranjit Kumar Paul <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-01-21 03:56:01 UTC |
Source: | https://github.com/cran/TSLSTM |
The LSTM (Long Short-Term Memory) model is a Recurrent Neural Network (RNN) based architecture 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.
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 )
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 )
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 |
TrainFittedValue: Fitted value of train data
TestPredictedValue: Predicted value of test data
AccuracyTable: RMSE and MAPE of train and test data
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
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)
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)