我正在通过ssh在远程服务器上使用keras进行实验,这不允许我在屏幕上绘制任何内容。
我有一个文本文件,保存了培训和验证损失以及准确性。我是从文件中绘制值的新手。如何使用Python做到这一点?
Pss I:完整文件可以找到here。看起来像这样
时期,acc,损失,lr,val_acc,val_loss 0,0.98254053473639,0.22349346622241112,0.001,0.9660620203871263,0.1419218496403809 1,0.991044776119403,0.06417229526104123,0.001,0.9958764657866986,0.047694865757175145 2,0.9928579098341795,0.04990571241149974,0.001,0.9843434560371118,0.08517235491136826 ...
P.s II:我想在此文件中绘制数据,例如in this site
答案 0 :(得分:1)
您可以为此使用熊猫。阅读说明以绘制所需的确切数据配置。
import pandas as pd
import matplotlib.pyplot as plt
file = pd.read_csv('test.txt')
plot = file.plot.line('loss')
plt.show()
https://pandas.pydata.org/pandas-docs/version/0.23/generated/pandas.DataFrame.plot.line.html
答案 1 :(得分:1)
我用Sharky的建议解决了这个问题。这是我的代码:
:hover