def build_model(look_back: int, batch_size: int=1) -> Sequential:
"""
The function builds a keras Sequential model
:param look_back: number of previous time steps as int
:param batch_size: batch_size as int, defaults to 1
:return: keras Sequential model
"""
model = Sequential()
model.add(LSTM(64,
activation='relu',
batch_input_shape=(batch_size, look_back, 1),
stateful=True,
return_sequences=False))
model.add(Dense(1, activation='linear'))
model.compile(loss='mean_squared_error', optimizer='adam')
return model
评论列表
文章目录