def hellinger(x, y, return_sum=False):
    """Calculate the Hellinger discrimination between two distributions.

    Parameters
    ----------
    x : array-like
        Discrete probability distribution.

    y : array-like
        Discrete probability distribution.

    return_sum : bool
        Return sum of jensen shannon values.

    Returns
    -------
    hellinger : float or numpy.ndarray
    """
    x, y = _check_x_y(x, y)

    h = 0.5 * (np.sqrt(x) - np.sqrt(y)) ** 2

    if return_sum:
        return h.sum()
    else:
        return h
Calculate the Hellinger discrimination between two distributions.

    Parameters
    ----------
    x : array-like
        Discrete probability distribution.

    y : array-like
        Discrete probability distribution.

    return_sum : bool
        Return sum of jensen shannon values.

    Returns
    -------
    hellinger : float or numpy.ndarray
    
optbinning/binning/metrics.py