这是我当前的图表:
我想做的是在执行验证测试的橙色线上添加错误栏...
这是原始变量的样子
train : list of tuples where the first position is batch number and second is the
associated loss
e.g. [(batch, loss), (batch, loss), ...]
test : list of tuples where the first position is batches processed when the
validation was conducted, and the second position is a list of batch losses
e.g. [(batch, [loss, loss, ...]), (batch, [loss, loss, ...]), ...]
这是我制作剧情的方式
plt.style.use('ggplot')
df_train = pd.DataFrame(train, columns=["Batch","Train"])
df_val = pd.DataFrame([(batch,sum(losses)/len(losses)) for batch, losses in test], # avg losses from test cycle
columns=["Batch","Test"])
data = df_train.merge(df_val, "outer").sort_values("Batch")
data.interpolate(method="linear").plot(x="Batch", color=["#2976bf","#d57f2e"])
我应该以某种方式在此图上叠加plt.errorbar
图吗?解决此问题的正确方法是什么?如果有更好的工具,我很乐意使用其他绘图库。