Answer the question
In order to leave comments, you need to log in
How to properly form kerasa lstm?
Tell me how to correctly build a grid model
like this I collect a sample and a model
def create_dataset(dataset, look_back, out_n):
dataX, dataY = [], []
for i in range(len(dataset)-look_back-out_n):
dataX.append(dataset[i:(i+look_back)])
dataY.append(dataset[i+look_back:(i+look_back+out_n) , 0:1])
return np.array(dataX), np.array(dataY)
input_n = 48
out_n=24
print(dX.shape, dY.shape) #(1927, 48, 6) (1927, 24, 1)
model = Sequential()
model.add(LSTM(128, input_shape=(dX.shape[1], dX.shape[2]),return_sequences=True))
model.add(Dense(dY.shape[1]))
Answer the question
In order to leave comments, you need to log in
Option 1: return_sequences=False.
Option 2: model.add(GlobalMaxPool1D()) between LSTM and Dense.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question