matplotlib画图
程序员文章站
2022-03-01 22:16:09
...
hist = model.fit(seq_array, label_array, epochs=1000, batch_size=200, validation_split=0.05, verbose=1,callbacks=[early_stopping, model_checkpoint])
import matplotlib.pyplot as plt
#plots
# list all data in history
print(hist.history.keys())
# summarize history for accuracy
plt.plot(hist.history['mean_squared_error'])
plt.plot(hist.history['val_mean_squared_error'])
plt.title('mse')
plt.ylabel('mean_squared_error')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.show()
# summarize history for loss
plt.plot(hist.history['loss'])
plt.plot(hist.history['val_loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.show()
print(hist.history.keys()) #可以通过打印查看historylist的值
plt.legend: loc:图例位置
上一篇: matplotlib画图