Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Zausinger committed Jan 16, 2025
1 parent 62b346c commit 873fd1a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ntl/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ def calculate_metrics(self, number_results, total_count):
v2 = number_results[:,1]
v1_valid = v1[~np.isnan(v1) & ~np.isnan(v2)]
v2_valid = v2[~np.isnan(v1) & ~np.isnan(v2)]
pearson = stats.pearsonr(v1_valid, v2_valid).statistic
spearman = stats.spearmanr(v1_valid, v2_valid).statistic

if len(v1_valid) < 2 and len(v2_valid) < 2:
pearson = 0
spearman = 0
else:
pearson = stats.pearsonr(v1_valid, v2_valid).statistic
spearman = stats.spearmanr(v1_valid, v2_valid).statistic

return (
mae,
Expand Down

0 comments on commit 873fd1a

Please sign in to comment.