def METHOD_NAME(
    benefits: np.array,
    alpha: float,
    use_abs_val: bool,
    error_tolerance: float = 1e-12,
) -> float:
    """
    Returns the general entropy index, a measure of redundancy in the data.
    https://en.wikipedia.org/wiki/Generalized_entropy_index
    :param benefits: The probabilities of each feature value combination
        occurring in the data.
    :type benefits: np.array
    :param alpha: A parameter which regulates the weight given to distances
        between benefits at different parts of the distribution.
    :type alpha: float
    :param use_abs_val: Whether to use the absolute value of the benefits
        or not.
    :type use_abs_val: bool
    :param error_tolerance: The error tolerance to use when calculating
        the generalized entropy index.
    :type error_tolerance: float
    :return: The generalized entropy index.
    :rtype: float
    """
    if use_abs_val:
        benefits = np.absolute(benefits)
    benefits_mean = np.mean(benefits)
    norm_benefits = benefits / benefits_mean
    count = norm_benefits.size
    if abs(alpha - 1.0) < error_tolerance:
        gei = np.sum(norm_benefits * np.log(norm_benefits)) / count
    elif abs(alpha) < error_tolerance:
        gei = np.sum(-np.log(norm_benefits)) / count
    else:
        gei = np.sum(np.power(norm_benefits, alpha) - 1.0) / (
            count * alpha * (alpha - 1.0)
        )
    return gei