geekyrakshit commited on
Commit
9e04c4b
1 Parent(s): 04b1ee4

fix: accuracy metric

Browse files
Files changed (1) hide show
  1. guardrails_genie/metrics.py +3 -1
guardrails_genie/metrics.py CHANGED
@@ -24,6 +24,8 @@ class AccuracyMetric(weave.Scorer):
24
  field in the output dictionary, when converted to an integer, matches
25
  the provided label.
26
 
 
 
27
  Args:
28
  output (dict): A dictionary containing the model's prediction,
29
  specifically the 'safe' key which holds the predicted value.
@@ -33,7 +35,7 @@ class AccuracyMetric(weave.Scorer):
33
  dict: A dictionary with a single key 'correct', which is True if the
34
  prediction matches the label, otherwise False.
35
  """
36
- return {"correct": label == int(output["safe"])}
37
 
38
  @weave.op()
39
  def summarize(self, score_rows: list) -> Optional[dict]:
 
24
  field in the output dictionary, when converted to an integer, matches
25
  the provided label.
26
 
27
+ The scorer assumes that the dataset labels are 0 for safe and 1 for unsafe.
28
+
29
  Args:
30
  output (dict): A dictionary containing the model's prediction,
31
  specifically the 'safe' key which holds the predicted value.
 
35
  dict: A dictionary with a single key 'correct', which is True if the
36
  prediction matches the label, otherwise False.
37
  """
38
+ return {"correct": label != int(output["safe"])}
39
 
40
  @weave.op()
41
  def summarize(self, score_rows: list) -> Optional[dict]: