[Fix] the issue where scores are negative in the Lawbench dataset evaluation(#1402) (#1403)

This commit is contained in:
yaoyingyy 2024-08-08 16:08:26 +08:00 committed by GitHub
parent 818d72a650
commit decb621ff6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,9 +43,12 @@ def compute_ljp_imprison(data_dict):
score_list.append(abs(math.log(answer_digit + 1) - math.log(prediction_digit_month + 1)))
else:
score_list.append(math.log(216))
# compute the average of score_list (log distance)
log_distance = sum(score_list) / len(score_list)
# normalize the score to between 0 and 1
log_distance = (math.log(216) - log_distance)/math.log(216)
if abstentions == len(score_list):
log_distance = 0
else:
# compute the average of score_list (log distance)
log_distance = sum(score_list) / len(score_list)
# normalize the score to between 0 and 1
log_distance = (math.log(216) - log_distance)/math.log(216)
return {"score": log_distance, "abstention_rate": abstentions/len(data_dict)}