coefficient.
if any(np.isnan(x) or x <=0 for x in [spearman_score["low"], pearson_score["low"]]):
acc_harmonic_mean = float("NaN")
low_harmonic_mean = float("NaN")
high_harmonic_mean = float("NaN")
else:
acc_harmonic_mean = hmean([spearman_score["acc"], pearson_score["acc"]])
After Change
for interval in intervals:
if any(np.isnan(x) for x in [spearman_score[interval], pearson_score[interval]]):
scores.append(float("NaN"))
elif any(x <= 0 for x in [spearman_score[interval], pearson_score[interval]]):
scores.append(0)
else:
scores.append(hmean([spearman_score[interval], pearson_score[interval]]))