如何检查在python代码中使用LSTM创建的顺序模型?

时间:2022-06-16 08:14:44

I have an algorithm written in python, it is timeseries analysis using LSTM. My professor asked me to show the details of the model that is created in the code. How do I inspect the "model" here? Does it have some visualization of the model in the background?

我有一个用python编写的算法,它是使用LSTM进行的时间序列分析。我的教授让我展示代码中创建的模型的细节。我如何在这里检查“模型”?它是否在后台有一些模型可视化?

model = Sequential()
model.add(LSTM(50, input_shape=(trainX.shape[1], trainX.shape[2])))
model.add(Dropout(0.2))
model.add(Dense(1))
model.compile(loss='mae', optimizer='adam')
history = model.fit(trainX, trainY, epochs=50, batch_size=72, validation_data=(testX, testY), verbose=0, shuffle=False)

1 个解决方案

#1


0  

There is a visualization tool in Keras called plot_model. You can use it to save your model as an image where you can see the structure of your model including input and output dimensions.

Keras中有一个名为plot_model的可视化工具。您可以使用它将模型保存为图像,您可以在其中查看模型的结构,包括输入和输出尺寸。

from keras.utils import plot_model
plot_model(model, to_file='model.png')

You can read more about it here: Keras Visualization

你可以在这里阅读更多相关内容:Keras Visualization

#1


0  

There is a visualization tool in Keras called plot_model. You can use it to save your model as an image where you can see the structure of your model including input and output dimensions.

Keras中有一个名为plot_model的可视化工具。您可以使用它将模型保存为图像,您可以在其中查看模型的结构,包括输入和输出尺寸。

from keras.utils import plot_model
plot_model(model, to_file='model.png')

You can read more about it here: Keras Visualization

你可以在这里阅读更多相关内容:Keras Visualization