def plot_info_retrieval(precisions, save_file):
# markers = ["|", "D", "8", "v", "^", ">", "h", "H", "s", "*", "p", "d", "<"]
markers = ["D", "p", 's', "*", "d", "8", "^", "H", "v", ">", "<", "h", "|"]
ticks = zip(*zip(*precisions)[1][0])[0]
plt.xticks(range(len(ticks)), ticks)
new_x = interpolate.interp1d(ticks, range(len(ticks)))(ticks)
i = 0
for model_name, val in precisions:
fr, pr = zip(*val)
plt.plot(new_x, pr, linestyle='-', alpha=0.7, marker=markers[i],
markersize=8, label=model_name)
i += 1
# plt.legend(model_name)
plt.xlabel('Fraction of Retrieved Documents')
plt.ylabel('Precision')
legend = plt.legend(loc='upper right', shadow=True)
plt.savefig(save_file)
plt.show()
评论列表
文章目录