__author__ = 'thorwhalen'

import numpy as np

# def entropy(labels):
#  """
#  got from : http://stackoverflow.com/questions/15450192/fastest-way-to-compute-entropy-in-python
#  Computes entropy of label distribution.
#  """
#     n_labels = len(labels)
#
#     if n_labels <= 1:
#         return 0
#
#     counts = np.bincount(labels)
#     probs = counts / n_labels
#     n_classes = np.count_nonzero(probs)
#
#     if n_classes <= 1:
#         return 0
#     ent = 0.
#
#     # Compute standard entropy.
#     for i in probs:
#         ent -= i * np.log(i, base=n_classes)
#     return ent
