svenwey commited on
Commit
781f224
·
1 Parent(s): b8bf7c3

test len instead of comparing to empty list

Browse files
Files changed (1) hide show
  1. logmetric.py +1 -1
logmetric.py CHANGED
@@ -139,7 +139,7 @@ class LogMetric(evaluate.Metric):
139
  if P == 0 and R == 0: return 1.0 # since this leads to (|R| + |P|) = 0
140
  return 1 - (np.sum(np.abs(R - P) / (np.abs(R) + np.abs(P)))) # (n = 1)
141
  else:
142
- if P == [] and R == []: return 1.0 # since this leads to n = 0
143
  n = len(P)
144
  P = np.array(P)
145
  R = np.array(R)
 
139
  if P == 0 and R == 0: return 1.0 # since this leads to (|R| + |P|) = 0
140
  return 1 - (np.sum(np.abs(R - P) / (np.abs(R) + np.abs(P)))) # (n = 1)
141
  else:
142
+ if len(P) == 0 and len(R) == 0: return 1.0 # since this leads to n = 0
143
  n = len(P)
144
  P = np.array(P)
145
  R = np.array(R)