3DEval / 3.py
slongle's picture
Upload 3.py with huggingface_hub
9dea289 verified
Raw History Blame Contribute Delete
739 Bytes
import json
import numpy as np
from matplotlib import pyplot as plt
result = json.load(open("correct_result.json"))
'''
correct = []
wrong = []
for i in range(len(result)):
for j in range(3):
if result[i][j]:
correct.append((i + 1, j + 1))
else:
wrong.append((i + 1, j + 1))
plt.scatter(*zip(*correct), color="green")
plt.scatter(*zip(*wrong), color="red")
plt.xlim(0, len(result) + 1) # x轴范围
plt.ylim(0, 4) # y轴范围
'''
mat = np.array(result).T
fig, ax = plt.subplots()
sc = ax.matshow(mat)
# cbar = plt.colorbar(sc, ax=ax, ticks=[0, 1])
# cbar.ax.set_yticklabels(['错误', '正确'])
plt.savefig("correct.png")
print(mat[0, :].mean(), mat[1, :].mean(), mat[2, :].mean())