import math


def calculate_entropy(classification1, classification2):
    """
    calculate entropy for the split
    :param classification1: total count of records in classification 1
    :param classification2: total count of records in classification 2
    :return:  calculated gini index for the split
    """
    if classification1 == 0 or classification2 == 0:
        return 0
    # computation of classification1
    c1_comp = (classification1 / (classification1 + classification2))

    # computation of classification2
    c2_comp = (classification2 / (classification1 + classification2))

    return -1 * (c1_comp * math.log(c1_comp, 2) + c2_comp * math.log(c2_comp, 2))