danieldux commited on
Commit
5af5762
1 Parent(s): 770d3de

Refactor code to extract ISCO codes from predictions and references

Browse files
Files changed (1) hide show
  1. isco_hierarchical_accuracy.py +8 -2
isco_hierarchical_accuracy.py CHANGED
@@ -273,8 +273,14 @@ class ISCO_Hierarchical_Accuracy(evaluate.Metric):
273
  """Returns the accuracy scores."""
274
  # Convert the inputs to strings
275
  if len(predictions[0]) > 4:
276
- predictions = [self._extract_isco_code(p) for p in predictions]
277
- references = [self._extract_isco_code(r) for r in references]
 
 
 
 
 
 
278
  predictions = [str(p) for p in predictions]
279
  references = [str(r) for r in references]
280
 
 
273
  """Returns the accuracy scores."""
274
  # Convert the inputs to strings
275
  if len(predictions[0]) > 4:
276
+ extracted_predictions = []
277
+ extracted_references = []
278
+ for p in predictions:
279
+ extracted_predictions.append(self._extract_isco_code(p))
280
+ for r in references:
281
+ extracted_references.append(self._extract_isco_code(r))
282
+ predictions = extracted_predictions
283
+ references = extracted_references
284
  predictions = [str(p) for p in predictions]
285
  references = [str(r) for r in references]
286