, stateful=True, , , , , .
, y be shifte x ( ). :
training_set = df_train.values
training_set = min_max_scaler.fit_transform(training_set)
x_train = training_set[0:len(training_set)-1]
y_train = training_set[1:len(training_set)]
x_train = np.reshape(x_train, (len(x_train), 1, 1))
LSTM (number_of_sequences, number_of_steps,features).
, 1 , , LSTM . ( ).
, 1 , (1, len(x_train), 1).
, y_train .
, , , LSTM return_sequences=True. y . , ( ).
, , .
stateful=True LSTM.
, reset : model.reset_states() - , .
X_train ( , , , : ).
predictions = model.predict(`X_train`)
, , , :
future = []
currentStep = predictions[:,-1:,:]
for i in range(future_pred_count):
currentStep = model.predict(currentStep)
future.append(currentStep)
model.reset_states()
2- , , , .
( stateful=False, reset - , reset , , stateful=True, , )
https://github.com/danmoller/TestRepo/blob/master/TestBookLSTM.ipynb