Skip to content

Commit

Permalink
labels is list, should be numpy array
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasquale Minervini committed Oct 25, 2017
1 parent 9121c63 commit 6538e64
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jack/util/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,9 @@ def apply_metrics(self, tensors: Mapping[TensorPort, np.ndarray]) -> Mapping[str
labels = tensors[Ports.Target.target_index]
predictions = tensors[Ports.Prediction.candidate_index]

acc_exact = np.sum(np.equal(labels, predictions))
acc_f1 = f1_score(np.array(labels), np.array(predictions), average='macro') * labels.shape[0]
labels_np = np.array(labels)
acc_exact = np.sum(np.equal(labels_np, predictions))
acc_f1 = f1_score(labels_np, predictions, average='macro') * labels_np.shape[0]

return {"F1_macro": acc_f1, "Accuracy": acc_exact}

Expand Down

0 comments on commit 6538e64

Please sign in to comment.