UCS2014 commited on
Commit
87e91c1
·
verified ·
1 Parent(s): fe237e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -162,9 +162,8 @@ def pearson_r(y_true, y_pred) -> float:
162
  p = np.asarray(y_pred, dtype=float)
163
 
164
  # Check for constant arrays, where std dev would be zero.
165
- # We must check both true and predicted arrays.
166
  if a.size < 2 or np.all(a == a[0]) or np.all(p == p[0]):
167
- return float("nan")
168
 
169
  return float(np.corrcoef(a, p)[0, 1])
170
 
 
162
  p = np.asarray(y_pred, dtype=float)
163
 
164
  # Check for constant arrays, where std dev would be zero.
 
165
  if a.size < 2 or np.all(a == a[0]) or np.all(p == p[0]):
166
+ return float("nan")
167
 
168
  return float(np.corrcoef(a, p)[0, 1])
169