Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions metrics/accuracy/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ def _info(self):
)

def _compute(self, predictions, references, normalize=True, sample_weight=None):
if len(predictions) != len(references):
raise ValueError(
f"Predictions and references must have the same length, "
f"got {len(predictions)} and {len(references)}."
)

if len(predictions) == 0:
raise ValueError("Predictions and references must not be empty.")

return {
"accuracy": float(
accuracy_score(references, predictions, normalize=normalize, sample_weight=sample_weight)
Expand Down
Empty file added metrics/meteor/__init__.py
Empty file.