def real2binary(y, threshold=0.5, inclusive=True):
    """
    Convert real values (-inf,inf) -> binary values {0,1}

    Parameters
    ----------
    y: np.array (n,c) float/int (-inf,inf)

    threshold: float (-inf, inf)
        value greater than this is converted into 1, otherwise 0

    inclusive: bool
        if True, equal to threshold -> 1, else -> 0

    Returns 
    -------
    np.array (n,c) int {0,1}
    """
    if inclusive:
        return (y >= threshold).astype(int)
    else:
        return (y > threshold).astype(int)