Demo entry 6777201

Keras LSTM model

   

Submitted by anonymous on Dec 08, 2018 at 15:42
Language: Python. Code size: 459 Bytes.

from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.layers import LSTM
from keras.optimizers import RMSprop

def get_model(num_chars):
    model = Sequential()
    model.add(LSTM(16, input_shape=(SEQLEN, num_chars)))
    model.add(Dense(num_chars))
    model.add(Activation('softmax'))

    optimizer = RMSprop(lr=0.01)
    model.compile(loss='categorical_crossentropy', optimizer=optimizer)
    return model

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).