keras实现多层LSTM

model = Sequential()
model.add(LSTM(units=hidden, input_shape=(time_steps, input_size),return_sequences=True))#返回所有节点的输出
model.add(LSTM(units=hidden,return_sequences=False))#返回最后一个节点的输出
##
# model.add(Dense(1, activation='softmax'))
model.add(Dense(1, activation='sigmoid'))
# model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

你可能感兴趣的:(Keras,tensorflow,深度学习知识框架与python)