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

fix multilabel metric reporter #1115

Closed
Closed
Changes from all 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
18 changes: 18 additions & 0 deletions pytext/metric_reporters/classification_metric_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,21 @@ def calculate_metric(self):
self.calculate_loss(),
recall_at_precision_thresholds=self.recall_at_precision_thresholds,
)

def predictions_to_report(self):
"""
Generate human readable predictions
"""
return [
[self.label_names[pred] for pred in predictions]
for predictions in self.all_preds
]

def targets_to_report(self):
"""
Generate human readable targets
"""
return [
[self.label_names[target] for target in targets]
for targets in self.all_targets
]