October 2018
Intermediate to advanced
252 pages
6h 49m
English
# define LSTM configurationn_neurons = 200n_batch = 1n_epoch = 1000n_features = n_unique
model = Sequential()model.add(LSTM(n_neurons, batch_input_shape=(n_batch, 1, n_features), stateful=True))model.add(Dense(n_unique, activation='sigmoid'))model.compile(loss='binary_crossentropy', optimizer='adam')
Notice that we are using a two-layer network with LSTM as one layer followed by a dense layer. The activation function being used is sigmoid and the loss function being used is binary_crossentropy.