class_docstr: Mostly borrowed from <https://github.com/clarkkev/deep-coref/blob/master/evaluation.py>
class_docstr_tok: ["Mostly","borrowed","from","<","https",":","\/\/github.com\/clarkkev\/deep-coref\/blob\/master\/evaluation.py",">"]
docstr: Averaged per-mention precision and recall.
  <https://pdfs.semanticscholar.org/cfe3/c24695f1c14b78a5b8e95bcbd1c666140fd1.pdf>
docstr_tok: ["Averaged","per-mention","precision","and","recall",".","<","https",":","\/\/pdfs.semanticscholar.org\/cfe3\/c24695f1c14b78a5b8e95bcbd1c666140fd1.pdf",">"]
code: def b_cubed(clusters, mention_to_gold):
      """
      Averaged per-mention precision and recall.
      <https://pdfs.semanticscholar.org/cfe3/c24695f1c14b78a5b8e95bcbd1c666140fd1.pdf>
      """
      numerator, denominator = 0, 0
      for cluster in clusters:
          if len(cluster) == 1:
              continue
          gold_counts = Counter()
          correct = 0
          for mention in cluster:
              if mention in mention_to_gold:
                  gold_counts[tuple(mention_to_gold[mention])] += 1
          for cluster2, count in list(gold_counts.items()):
              if len(cluster2) != 1:
                  correct += count * count
          numerator += correct / float(len(cluster))
          denominator += len(cluster)
      return numerator, denominator
  
imports: from __future__ import division
  from __future__ import absolute_import
  from collections import Counter
  from sklearn.utils.linear_assignment_ import linear_assignment
  import numpy
  import torch
  from allennlp.training.metrics.metric import Metric
label_desc: Use image node_id 7 for calling the Scorer obj's underlying member method code with example usage: obj.b_cubed(clusters, mention_to_gold) and returns: numerator,  denominator