def information_gain_proxy(
    impurity_left, impurity_right, w_samples_left, w_samples_right,
):
    """Computes a proxy of the information gain (improvement in impurity) using the
    equation

        - n_v0 * impurity_v0 - n_v1 * impurity_v1

    where:
        * n_v0, n_v1 are the weighted number of samples in the left and right nodes
        * impurity_v0, impurity_v1 are the impurities of the left and right nodes

    It is used in order to find the best split faster, by removing constant terms from
    the formula used in the information_gain function.

    Parameters
    ----------
    impurity_left : float
        Impurity of the left node

    impurity_right : float
        Impurity of the right node

    w_samples_left : float
        Weighted number of samples in the left node

    w_samples_right : float
        Weighted number of samples in the roght node

    Returns
    -------
    output : float
        Proxy of the information gain after splitting the parent into left
        and child nodes
    """
    return -w_samples_left * impurity_left - w_samples_right * impurity_right