[英]Keras: How to store history after each epoch?
I want to change my input after every epoch and at the end I want to plot learning curve.我想在每个时代之后改变我的输入,最后我想绘制学习曲线。
To change the input I have function which I can use as below要更改输入,我可以使用如下功能
for _ in range(num_epochs):
x, y = generate_data()
history = model.fit(x, y, epochs=1, batch_size=64)
But I am not able to capture the complete history for my model.但是我无法为我的模型捕获完整的历史记录。 How can I access it and plot learning curve?
如何访问它并绘制学习曲线?
You can use a dictionary to store the history
.您可以使用字典来存储
history
。
history_dict = dict()
for i in range(num_epochs):
x, y = generate_data()
history_dict['epoch_%i' % i] = model.fit(x, y, epochs=1, batch_size=64)
It will give something like that:它会给出类似的东西:
Out[4]:
{'epoch_0': <your history 1>,
'epoch_1': <your history 2>,
'epoch_2': <your history 3>,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.