def claclulate_gini_index(classification1, classification2):
    """
    calculate gini index 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 + classification2 == 0:
        return 0.5
    # square of fraction of data in classification 1
    c1_square = (classification1 / (classification1 + classification2)) ** 2

    # square of fraction of data in classification 2
    c2_square = (classification2 / (classification1 + classification2)) ** 2

    return 1 - c1_square - c2_square