Created
May 30, 2020 19:16
-
-
Save Vsanku01/9ef15d59462605462841ca8ca09ae70c to your computer and use it in GitHub Desktop.
LSTM Sine wave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
early_stop = EarlyStopping(monitor='val_loss',patience=2) | |
length = 49 | |
batch_size = 1 | |
generator = TimeseriesGenerator(scaled_train,scaled_train,length=length,batch_size=batch_size) | |
validation_generator = TimeseriesGenerator(scaled_test,scaled_test,length=length,batch_size=batch_size) | |
model = Sequential() | |
model.add(LSTM(50,input_shape=(length,n_features))) | |
model.add(Dense(1)) | |
model.compile(optimizer = 'adam',loss='mse',metrics=['accuracy']) | |
model.fit_generator(generator,epochs=20,validation_data=validation_generator,callbacks=[early_stop]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment