Sequential() 模型:搭建神经网络

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 中文文档

你可能感兴趣的:(Python内置函数,lstm,深度学习,神经网络)