Skip to content

Commit 363d20f

Browse files
committed
Fixed Precision metric and test. Should work now.
1 parent f2a4b90 commit 363d20f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CollaborativeCoding/metrics/precision.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import torch
22
import torch.nn as nn
3+
import numpy as np
34

45

56
class Precision(nn.Module):
@@ -101,7 +102,7 @@ def _macro_avg_precision(
101102

102103
def __returnmetric__(self):
103104
if self.y_true == [] and self.y_pred == []:
104-
return []
105+
return np.nan
105106
elif self.y_true == [] or self.y_pred == []:
106107
raise ValueError("y_true or y_pred is empty.")
107108
self.y_true = torch.cat(self.y_true)

0 commit comments

Comments
 (0)