LSTM 自编码器

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/stockholm0215/article/details/84954264
def build_model(layers,seq_len):  #layers [*,*,*,*,*]
    model = Sequential()

    model.add(LSTM(layers[1], input_shape=(seq_len, layers[0]),return_sequences=True))
    #model.add(Dropout(0.2))
    model.add(LSTM(layers[2], return_sequences=True))
    model.add(LSTM(layers[3], return_sequences=True))
    model.add(LSTM(layers[4], return_sequences=True))
    model.add(LSTM(layers[5], return_sequences=True))
    #model.add(Dropout(0.2))
    model.compile(loss=losses.mean_squared_error, optimizer=keras.optimizers.Adam
    (lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0, amsgrad=False))
    return model
model.fit(trainX,trainY,batch_size=batchSize,epochs=nb_epoch)
展开阅读全文

没有更多推荐了,返回首页