docstr: :param group: String, the ground truth group to check against
  :param span: String, the type of span to check
  :param match_groups: List of strings, the set of groups that should
  match the ground truth group under the current count_fn
  :param check_swap: Bool, whether or not the inverse (ground truth as
  pred) should also be checked
  :param metric_type: String, whether we should convert the groups using
  the groups dictionary or joint groups dicionary
docstr_tok: [":","param","group",":","String",",","the","ground","truth","group","to","check","against",":","param","span",":","String",",","the","type","of","span","to","check",":","param","match_groups",":","List","of","strings",",","the","set","of","groups","that","should","match","the","ground","truth","group","under","the","current","count_fn",":","param","check_swap",":","Bool",",","whether","or","not","the","inverse","(","ground","truth","as","pred",")","should","also","be","checked",":","param","metric_type",":","String",",","whether","we","should","convert","the","groups","using","the","groups","dictionary","or","joint","groups","dicionary"]
code: def check_group_counts(
      self,
      group,
      span_type,
      match_groups,
      check_swap=True,
      metric_type="group",
  ):
      """
      :param group: String, the ground truth group to check against
      :param span: String, the type of span to check
      :param match_groups: List of strings, the set of groups that should
      match the ground truth group under the current count_fn
      :param check_swap: Bool, whether or not the inverse (ground truth as
      pred) should also be checked
      :param metric_type: String, whether we should convert the groups using
      the groups dictionary or joint groups dicionary
      """
      count_fn = get_count_fn(metric_type, span_type)
  
      # Get dictionary to convert from str -> group
      if metric_type == "group":
          all_groups = self.groups
      elif metric_type == "joint":
          all_groups = self.joint_groups
  
      # Get groups that shouldn't match
      dif_groups = set(all_groups.keys()) - set(match_groups)
  
      # Strings to groups
      group = all_groups[group]
      match_groups = [all_groups[n] for n in match_groups]
      dif_groups = [all_groups[n] for n in dif_groups]
  
      for match_group in match_groups:
          # Correct matches should return 1 TP, 0 FP, 0 FN
          self.check_counts(
              count_fn,
              match_group,
              group,
              (1, 0, 0),
              check_swap=check_swap,
          )
      for dif_group in dif_groups:
          # Incorrect matches should return 0 TP, 1 FP, 1 FN
          self.check_counts(
              count_fn,
              dif_group,
              group,
              (0, 1, 1),
              check_swap=check_swap,
          )
  
imports: import unittest
  from copy import deepcopy
  from finetune.util.group_metrics import get_count_fn, calc_group_assignment, create_joint_groups, get_metrics, group_metrics, joint_metrics
label_desc: Use image node_id 11 for calling the TestGroupMetricCountFunctions obj's underlying member method code with example usage: obj.check_group_counts(group, span_type, match_groups, check_swap, metric_type) without return types