def count_overlapping_fingerprints(newly_inferred_events,
                                   expected_internal_events):
  expected_counts = Counter([e.fingerprint for e in expected_internal_events])
  inferred_counts = Counter([e.fingerprint for e in newly_inferred_events])
  total_redundant = 0
  for fingerprint, count in expected_counts.iteritems():
    if fingerprint in inferred_counts and inferred_counts[fingerprint] > count:
      redundant = inferred_counts[fingerprint] - count
      total_redundant += redundant
      # fingerprints[0] is the class name
      Peeker.ambiguous_events[fingerprint[0]] += redundant

  if len(newly_inferred_events) > 0:
    percent_redundant = total_redundant*1.0 / len(newly_inferred_events)
  else:
    percent_redundant = 0.0
  Peeker.ambiguous_counts[percent_redundant] += 1
Track # of instances where an expected event matches 2 or more inferred
dataset/ETHPy150Open ucb-sts/sts/sts/control_flow/peeker.py/count_overlapping_fingerprints