vamseelatha2002 commited on
Commit
2a67170
·
verified ·
1 Parent(s): cc5bac0

Update evaluation.py

Browse files
Files changed (1) hide show
  1. 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
- return np.sqrt(mean_squared_error(ground_truth_values, predicted_values))
 
 
 
 
 
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."""