我如何存储我的结果的形式和数值输出的形式/是否有一种通用方法来存储任何类型的结果?
我正在编写一个很长一段时间的程序。我想多次运行此程序,以便可以看到结果对参数调整的依赖性。 因此,假设与以下情况类似的情况:
parameter=1
"Big code that takes a long time"
print(output, "output that depends on t")
plt.plot(x,y)
现在将参数更改为2并重新运行。我希望能够提取前一个结果,以便可以比较它们。
因此,我想以某种方式存储它们,以便下次我需要查看结果时,我只需要执行几行,而存储的结果确实很快出现。
I am writing a program that runs for a long time. I want to run this program many times so that I can see the dependence of my results on the tweaking of parameters.
So, suppose a situation similar to the following:
parameter=1
"Big code that takes a long time"
print(output, "output that depends on t")
plt.plot(x,y)
Now change the parameter to 2 and re-run again. I want to be able to pull the results of the previous one so that I can compare them.
So I want to sort of store them somehow so that the next time I need to look at the results I just have to execute a few lines and the stored results come up really quickly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将所有信息(例如输入,参数和输出)存储在字典中。然后,您可以使用dict进行进一步的绘图和分析。
在这里,我添加了一个最小的可重复示例。您可以将其用作您需求的参考。以下代码将此图作为输出产生。
You can store all the information such as the inputs, params, and outputs in a dictionary. You can then use the dict to do further plotting and analysis.
Here I add a minimal reproducible example. You can use this as a reference for your needs. The below code produces this plot as an output.