Is my first approach to LSTM. I m trying to predict a Forecast in a time series. I m following this Github example
And all work for me in the same way.
I slip in train and test, I plot the loss and plot a difference for actual and predicted.
But if I want to predict the next month's values? Is possible with LSTM?
I obtained this graph, but isn't very interesting for me, because I wish to try to predict future values, in order to try to understand the trend
This is my split data in train and test set :
# Split into training/test sets
train_size = int(len(data) * 0.8)
train, test = data[:train_size,], data[train_size:,]
# Prepare the data in a format required for LSTM (samples, timesteps, features)
def Create_Dataset(df, lookback=1):
X, Y = [], []
for i in range(len(df) - lookback - 1):
X.append(df[i:(i+lookback), 0])
Y.append(df[i + lookback,0])
return np.array(X), np.array(Y)
lookback = 30
X_train, Y_train = Create_Dataset(train, lookback)
X_test, Y_test = Create_Dataset(test, lookback)
X_train = np.reshape(X_train, (X_train.shape[0], 1, X_train.shape[1]))
X_test = np.reshape(X_test, (X_test.shape[0], 1, X_test.shape[1]))