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 list(conf_matrix.items()):
    error = 0.0
    total = 0.0
    for guess, count in list(guess_dict.items()):
      if true_response != guess:
        error += count
      total += count
    parts.append(error/total)
  BER = sum(parts)/len(parts)
  return 1 - BER