datasketch/lshensemble_partition.py
def _compute_nfp_uniform(l, u, cum_counts, sizes):
    """Computes the expected number of false positives caused by using
    u to approximate set sizes in the interval [l, u], assuming uniform
    distribution of set sizes within the interval.

    Args:
        l: the lower bound on set sizes.
        u: the upper bound on set sizes.
        cum_counts: the complete cummulative distribution of set sizes.
        sizes: the complete domain of set sizes.

    Return (float): the expected number of false positives.
    """
    if l > u:
        raise ValueError("l must be less or equal to u")
    if l == 0:
        n = cum_counts[u]
    else:
        n = cum_counts[u]-cum_counts[l-1]
    return n * float(sizes[u] - sizes[l]) / float(2*sizes[u])
def _compute_nfp_uniform(l, u, cum_counts, sizes):
    """Computes the expected number of false positives caused by using
    u to approximate set sizes in the interval [l, u], assuming uniform
    distribution of set sizes within the interval.

    Args:
        l: the lower bound on set sizes.
        u: the upper bound on set sizes.
        cum_counts: the complete cummulative distribution of set sizes.
        sizes: the complete domain of set sizes.

    Return (float): the expected number of false positives.
    """
    if l > u:
        raise ValueError("l must be less or equal to u")
    if l == 0:
        n = cum_counts[u]
    else:
        n = cum_counts[u]-cum_counts[l-1]
    return n * float(sizes[u] - sizes[l]) / float(2*sizes[u])
Computes the expected number of false positives caused by using
    u to approximate set sizes in the interval [l, u], assuming uniform
    distribution of set sizes within the interval.

    Args:
        l: the lower bound on set sizes.
        u: the upper bound on set sizes.
        cum_counts: the complete cummulative distribution of set sizes.
        sizes: the complete domain of set sizes.

    Return (float): the expected number of false positives.