######################导入库##########################
import os
os.environ['KERAS_BACKEND']='tensorflow'
import keras
import tensorflow as tf
from keras import optimizers#优化器
from keras.models import Sequential, load_model
from keras.layers import Dense, LSTM
from keras.layers import Dropout
1层LSTM
def lstm_single(x,y,hidden_cell,epoch,batch_size,verbose):
#verbose=0不显示训练进度,verbose=2显示训练进度和每个epoch所需时间
model = Sequential()
model.add(LSTM(hidden_cell, input_shape=(x.shape[1],1)))
model.add(Dense(1))
adam=optimizers.Adam(learning_rate=0.01)
model.compile(loss='mean_squared_error', optimizer=adam)
model.fit(x,y, epochs=epoch, batch_size=batch_size, verbose=verbose)
#loss=model.history.history['loss']#记录模型模型的损失函数值
return model