python2_source/BlackBoxAuditing/measurements.py
def BCR(conf_matrix):
  """
  Given a confusion matrix, returns Balanced Classification Rate.
  BCR is (1 - Balanced Error Rate).
  BER Definition: http://research.ics.aalto.fi/events/eyechallenge2005/evaluation.shtml
  """
  parts = []
  for true_response, guess_dict in conf_matrix.items():
    error = 0.0
    total = 0.0
    for guess, count in guess_dict.items():
      if true_response != guess:
        error += count
      total += count
    parts.append(error/total)
  BER = sum(parts)/len(parts)
  return 1 - BER
def BCR(conf_matrix):
  """
  Given a confusion matrix, returns Balanced Classification Rate.
  BCR is (1 - Balanced Error Rate).
  BER Definition: http://research.ics.aalto.fi/events/eyechallenge2005/evaluation.shtml
  """
  parts = []
  for true_response, guess_dict in conf_matrix.items():
    error = 0.0
    total = 0.0
    for guess, count in guess_dict.items():
      if true_response != guess:
        error += count
      total += count
    parts.append(error/total)
  BER = sum(parts)/len(parts)
  return 1 - BER
Given a confusion matrix, returns Balanced Classification Rate.
  BCR is (1 - Balanced Error Rate).
  BER Definition: http://research.ics.aalto.fi/events/eyechallenge2005/evaluation.shtml