Created
January 12, 2020 05:26
-
-
Save kumar-abhishek/8017f37ac2084c1ea1b2488b516c0dd0 to your computer and use it in GitHub Desktop.
GRU
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
from keras.models import Sequential | |
from keras.layers import GRU, Dense | |
n_features = 4 | |
model_gru = Sequential() | |
model_gru.add(TimeDistributed(Dense(128), input_shape=(None, n_features))) | |
model_gru.add(GRU(64, activation='tanh', input_shape=(None, n_features), return_sequences=True)) | |
model_gru.add(BatchNormalization()) | |
model_gru.add(GRU(32 , activation = 'tanh')) | |
model_gru.add(BatchNormalization()) | |
model_gru.add(Dropout(0.2)) | |
model_gru.add(Dense(n_features, activation='softmax')) | |
model_gru.compile(optimizer='adam', loss='categorical_crossentropy') | |
model_gru.fit_generator(generator, epochs=500, validation_data=validation_generator) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment