使用 Keras 构建语言建模的循环神经网络(RNN)
David Cecchini
Data Scientist
文本生成模型:
categorical_crossentropymodel = Sequential()model.add(LSTM(units, input_shape=(chars_window, n_vocab), dropout=0.15, recurrent_dropout=0.15, return_sequences=True))model.add(LSTM(units, dropout=dropout, recurrent_dropout=0.15, return_sequences=False))model.add(Dense(n_vocab, activation='softmax'))model.compile(loss='categorical_crossentropy', optimizer='adam')
与分类的区别:

使用 Keras 构建语言建模的循环神经网络(RNN)