datasketch/lshensemble_partition.py
def _compute_nfps_uniform(cum_counts, sizes):
    """Computes the matrix of expected false positives for all possible
    sub-intervals of the complete domain of set sizes, assuming uniform
    distribution of set_sizes within each sub-intervals.

    Args:
        cum_counts: the complete cummulative distribution of set sizes.
        sizes: the complete domain of set sizes.

    Return (np.array): the 2-D array of expected number of false positives
        for every pair of [l, u] interval, where l is axis-0 and u is
        axis-1.
    """
    nfps = np.zeros((len(sizes), len(sizes)))
    # All u an l are inclusive bounds for intervals.
    # Compute p = 1, the NFPs
    for l in range(len(sizes)):
        for u in range(l, len(sizes)):
            nfps[l, u] = _compute_nfp_uniform(l, u, cum_counts, sizes)
    return nfps
def _compute_nfps_uniform(cum_counts, sizes):
    """Computes the matrix of expected false positives for all possible
    sub-intervals of the complete domain of set sizes, assuming uniform
    distribution of set_sizes within each sub-intervals.

    Args:
        cum_counts: the complete cummulative distribution of set sizes.
        sizes: the complete domain of set sizes.

    Return (np.array): the 2-D array of expected number of false positives
        for every pair of [l, u] interval, where l is axis-0 and u is
        axis-1.
    """
    nfps = np.zeros((len(sizes), len(sizes)))
    # All u an l are inclusive bounds for intervals.
    # Compute p = 1, the NFPs
    for l in range(len(sizes)):
        for u in range(l, len(sizes)):
            nfps[l, u] = _compute_nfp_uniform(l, u, cum_counts, sizes)
    return nfps
def _compute_nfps_uniform ( cum_counts , sizes ) : nfps = np . zeros ( ( len ( sizes ) , len ( sizes ) ) ) # All u an l are inclusive bounds for intervals. # Compute p = 1, the NFPs for l in range ( len ( sizes ) ) : for u in range ( l , len ( sizes ) ) : nfps [ l , u ] = _compute_nfp_uniform ( l , u , cum_counts , sizes ) return nfps
Computes the matrix of expected false positives for all possible
    sub-intervals of the complete domain of set sizes, assuming uniform
    distribution of set_sizes within each sub-intervals.

    Args:
        cum_counts: the complete cummulative distribution of set sizes.
        sizes: the complete domain of set sizes.

    Return (np.array): the 2-D array of expected number of false positives
        for every pair of [l, u] interval, where l is axis-0 and u is
        axis-1.
Computes the matrix of expected false positives for all possible sub - intervals of the complete domain of set sizes assuming uniform distribution of set_sizes within each sub - intervals .