Skip to content

Instantly share code, notes, and snippets.

@ayushoriginal
Created June 24, 2019 06:23
Show Gist options
  • Save ayushoriginal/d667c0910de5a72054cc4cfd16fc628b to your computer and use it in GitHub Desktop.
Save ayushoriginal/d667c0910de5a72054cc4cfd16fc628b to your computer and use it in GitHub Desktop.
LSTM
def LSTM(self):
model = Sequential()
model.add(Embedding(self.vocab_length, 30, input_length=self.max_len))
model.add(LSTM(200))
model.add(Dense(self.max_len, activation='relu', W_regularizer=l2(0.90)))
model.add(Dense(self.tr_labels.shape[1], activation='softmax', W_regularizer=l2(0.1)))
adam_1 = Adam(lr=0.008)
model.compile(loss='categorical_crossentropy', optimizer=adam_1,metrics=['accuracy'])
model.summary()
self.model = model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment