In example plotting script, also plot hits@{1,3,10}
@@ -11,14 +11,29 @@ trace = Trace(tracefile, regex_filter='epoch')
train = trace.to_dataframe({'job': 'train', 'scope': 'epoch'})
valid = trace.to_dataframe({'job': 'eval', 'scope': 'epoch'})
-# plot train loss and validation mrr
-fig, axs = plt.subplots(2, 1, sharex=True)
+# plot train loss and validation mrr and hits@k
+fig, axs = plt.subplots(3, 1, sharex=True)
axs[0].plot(train.epoch, train.avg_loss)
axs[0].set_ylabel("avg loss (train)")
-axs[1].plot(valid.epoch, valid.mean_reciprocal_rank, label='MRR')
axs[1].plot(valid.epoch, valid.mean_reciprocal_rank_filtered,
label='MRR (filtered)')
+axs[1].plot(valid.epoch, valid.mean_reciprocal_rank,
+ label='MRR', linestyle='dashed', color='C0')
axs[1].set_ylabel("mrr (valid)")
axs[1].legend()
+axs[2].plot(valid.epoch, list(map(lambda x: x[0], valid.hits_at_k_filtered)),
+ label='Hits@1 (filtered)', color='C0')
+axs[2].plot(valid.epoch, list(map(lambda x: x[2], valid.hits_at_k_filtered)),
+ label='Hits@3 (filtered)', color='C1')
+axs[2].plot(valid.epoch, list(map(lambda x: x[9], valid.hits_at_k_filtered)),
+ label='Hits@10 (filtered)', color='C2')
+axs[2].plot(valid.epoch, list(map(lambda x: x[0], valid.hits_at_k)),
+ label='Hits@1', linestyle='dashed', color='C0')
+axs[2].plot(valid.epoch, list(map(lambda x: x[2], valid.hits_at_k)),
+ label='Hits@3', linestyle='dashed', color='C1')
+axs[2].plot(valid.epoch, list(map(lambda x: x[9], valid.hits_at_k)),
+ label='Hits@10', linestyle='dashed', color='C2')
+axs[2].set_ylabel("Hits@k (valid)")
+axs[2].legend()
input("Press Enter to continue...")
