Mohammed-Altaf commited on
Commit
03114ab
·
1 Parent(s): 7b9dfc1

grader changes for easy task

Browse files
Files changed (1) hide show
  1. tasks/task_easy.py +7 -3
tasks/task_easy.py CHANGED
@@ -42,14 +42,18 @@ class TopRevenueCategoryTask(BaseTask):
42
  return self.df.groupby("category")["total_price"].sum().idxmax()
43
 
44
  def grade(self, answer: str) -> float:
45
- """Grade the answer by case-insensitive string match.
 
 
 
 
46
 
47
  Args:
48
  answer: The agent's submitted category name.
49
 
50
  Returns:
51
- 1.0 if the answer matches the expected category, 0.0 otherwise.
52
  """
53
  expected = self.expected_answer().strip().lower()
54
  submitted = answer.strip().lower()
55
- return 1.0 if submitted == expected else 0.0
 
42
  return self.df.groupby("category")["total_price"].sum().idxmax()
43
 
44
  def grade(self, answer: str) -> float:
45
+ """Grade the answer by case-insensitive containment check.
46
+
47
+ Accepts the answer if the expected category name appears anywhere in
48
+ the submitted string, so responses like 'The top category is Clothing'
49
+ or 'Clothing ($74,792.74)' still receive full credit.
50
 
51
  Args:
52
  answer: The agent's submitted category name.
53
 
54
  Returns:
55
+ 1.0 if the expected category appears in the answer, 0.0 otherwise.
56
  """
57
  expected = self.expected_answer().strip().lower()
58
  submitted = answer.strip().lower()
59
+ return 1.0 if expected in submitted else 0.0