def triangular(x, y, return_sum=False):
    """Calculate the LeCam or triangular 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
    -------
    triangular : float or numpy.ndarray
    """
    x, y = _check_x_y(x, y)

    t = (x - y) ** 2 / (x + y)

    if return_sum:
        return t.sum()
    else:
        return t
Calculate the LeCam or triangular 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
    -------
    triangular : float or numpy.ndarray
    
optbinning/binning/metrics.py