MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / EM

Method EM

AgentBench.old/src/tasks/knowledgegraph/task.py:132–147  ·  view source on GitHub ↗
(outputs, targets)

Source from the content-addressed store, hash-verified

130 return F1_sum / count
131
132 def EM(outputs, targets):
133 em_sum = 0
134 count = 0
135 for i in range(len(outputs)):
136 if outputs[i] is None:
137 continue
138 count += 1
139 predicted_answer = set(outputs[i]['predict'])
140 gold_answer = targets[i]
141 if len(gold_answer.intersection(predicted_answer)) == len(gold_answer) and len(gold_answer.intersection(predicted_answer)) == len(predicted_answer):
142 em_sum += 1
143
144 if count == 0:
145 return 0
146 else:
147 return em_sum / count
148
149
150 def executability(outputs):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected