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: Computes the  Constrained EntityAlignment F-Measure (CEAF) for evaluating coreference.
  Gold and predicted mentions are aligned into clusterings which maximise a metric - in
  this case, the F measure between gold and predicted clusters.
  
  <https://www.semanticscholar.org/paper/On-Coreference-Resolution-Performance-Metrics-Luo/de133c1f22d0dfe12539e25dda70f28672459b99>
docstr_tok: ["Computes","the","Constrained","EntityAlignment","F-Measure","(","CEAF",")","for","evaluating","coreference",".","Gold","and","predicted","mentions","are","aligned","into","clusterings","which","maximise","a","metric","-","in","this","case",",","the","F","measure","between","gold","and","predicted","clusters",".","<","https",":","\/\/www.semanticscholar.org\/paper\/On-Coreference-Resolution-Performance-Metrics-Luo\/de133c1f22d0dfe12539e25dda70f28672459b99",">"]
code: def ceafe(clusters, gold_clusters):
      """
      Computes the  Constrained EntityAlignment F-Measure (CEAF) for evaluating coreference.
      Gold and predicted mentions are aligned into clusterings which maximise a metric - in
      this case, the F measure between gold and predicted clusters.
  
      <https://www.semanticscholar.org/paper/On-Coreference-Resolution-Performance-Metrics-Luo/de133c1f22d0dfe12539e25dda70f28672459b99>
      """
      clusters = [cluster for cluster in clusters if len(cluster) != 1]
      scores = np.zeros((len(gold_clusters), len(clusters)))
      for i, gold_cluster in enumerate(gold_clusters):
          for j, cluster in enumerate(clusters):
              scores[i, j] = Scorer.phi4(gold_cluster, cluster)
      matching = linear_assignment(-scores)
      similarity = sum(scores[matching[:, 0], matching[:, 1]])
      return similarity, len(clusters), similarity, len(gold_clusters)
  
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 10 for calling the Scorer obj's underlying member method code with example usage: obj.ceafe(clusters, gold_clusters) and returns: similarity,  len,  similarity,  len