Skip to content

Instantly share code, notes, and snippets.

@Vsanku01
Created May 30, 2020 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vsanku01/9ef15d59462605462841ca8ca09ae70c to your computer and use it in GitHub Desktop.
Save Vsanku01/9ef15d59462605462841ca8ca09ae70c to your computer and use it in GitHub Desktop.
LSTM Sine wave
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