self.flags["has_text_cands"] = True
for k in self.eval_pr:
if cnts[k] > 0:
self.metrics["hits@" + str(k)] += 1
self.metrics["hits@_cnt"] += 1
def update(self, observation, labels):
Update metrics based on an observation and true labels.
After Change
// (other metrics such as p@k and r@k take
// the value of cnt into account.)
for k in self.eval_pr:
self.add(f"hits@{k}", AverageMetric(cnts[k] > 0))
def evaluate_response(self, observation: Message, labels: List[str]) -> None:
Compute all required text-based metrics based on an observation and labels.