Skip to content

Instantly share code, notes, and snippets.

@mvivarelli
Created October 20, 2021 08:44
Show Gist options
  • Save mvivarelli/11ead87de00ae1b8b9269b6694f6e3c1 to your computer and use it in GitHub Desktop.
Save mvivarelli/11ead87de00ae1b8b9269b6694f6e3c1 to your computer and use it in GitHub Desktop.
Turbofan Engine stateful LSTM model
#model
model = Sequential()
#input
model.add(LSTM(units=50, return_sequences=True, activation='tanh', batch_size=batch_size, stateful=True, input_shape = (x_train_final.shape[1], x_train_final.shape[2])))
model.add(Dropout(0.2))
#hidden layer 1
model.add(LSTM(units=60, return_sequences=True, activation='tanh', stateful=True))
model.add(Dropout(0.2))
#hidden layer 2
model.add(LSTM(units=60, return_sequences=True, activation='tanh', stateful=True))
model.add(Dropout(0.2))
#output
model.add(Dense(units=3,activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment