Spaces:
Sleeping
Sleeping
Update evaluation.py
Browse files- evaluation.py +6 -1
evaluation.py
CHANGED
@@ -89,7 +89,12 @@ def adherence(response, relevant_documents):
|
|
89 |
|
90 |
# Step 6: Compute RMSE for metrics
|
91 |
def compute_rmse(predicted_values, ground_truth_values):
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
def retrieve_ground_truths(question, dataset):
|
95 |
"""Retrieve the ground truth answer for a given question from the dataset."""
|
|
|
89 |
|
90 |
# Step 6: Compute RMSE for metrics
|
91 |
def compute_rmse(predicted_values, ground_truth_values):
|
92 |
+
# Ensure that both predicted_values and ground_truth_values are numeric
|
93 |
+
if all(isinstance(i, (int, float)) for i in predicted_values) and all(isinstance(i, (int, float)) for i in ground_truth_values):
|
94 |
+
return np.sqrt(mean_squared_error(ground_truth_values, predicted_values))
|
95 |
+
else:
|
96 |
+
print("Invalid input for RMSE calculation. Ensure all values are numeric.")
|
97 |
+
return None
|
98 |
|
99 |
def retrieve_ground_truths(question, dataset):
|
100 |
"""Retrieve the ground truth answer for a given question from the dataset."""
|