1 作用

顺序模型,即通过一层层神经网络连接构建深度神经网络。

model=Sequential()

2 搭建神经网络

通过model.add() 叠加一些网络层如LSTM和Dense

# 单层 LSTM
model = Sequential()
model.add(LSTM(units=50, activation='relu',input_shape=(X_train.shape[1], 1)))
model.add(Dense(units=1)))

3. model.summary():查看最终的模型结构

model.summary()  # 输出模型结构

引用了循环层 Recurrent - Keras 中文文档

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐