rom keras.models import Sequential
from keras.layers import Dense, Embedding, LSTM
embed_dim = 128
lstm_out = 196
batch_size = 32
model = Sequential()
model.add(Embedding(2000, embed_dim,input_length = X.shape[1], dropout = 0.2))
model.add(LSTM(lstm_out, dropout_U = 0.2, dropout_W = 0.2))
model.add(Dense(2,activation='softmax'))
model.compile(loss = 'categorical_crossentropy', optimizer='adam',metrics = ['
keras——layers篇:Dense, Embedding, LSTM
最新推荐文章于 2025-03-28 17:57:59 发布