Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Add ability for Metrics to add metrics from another Metrics object #3145

Merged
merged 5 commits into from
Oct 2, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion parlai/core/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,17 @@ def share(self):
return {'data': self._data}


class TeacherMetrics(Metrics):
class MetricsCollection(Metrics):
moyapchen marked this conversation as resolved.
Show resolved Hide resolved
"""
Helper container for Metrics that can have other metrics added to it.
"""

def add_metrics(self, other: Metrics) -> None:
for k, v in other.report().items():
moyapchen marked this conversation as resolved.
Show resolved Hide resolved
self.add(k, v)


class TeacherMetrics(MetricsCollection):
"""
Helper container which encapsulates standard metrics (F1, BLEU, ...).
"""
Expand Down