datasketch/b_bit_minhash.py
def jaccard(self, other):
        '''
        Estimate the Jaccard similarity (resemblance) between this b-bit
        MinHash and the other.
        '''
        if self.b != other.b:
            raise ValueError("Cannot compare two b-bit MinHashes with different\
                    b values")
        if self.seed != other.seed:
            raise ValueError("Cannot compare two b-bit MinHashes with different\
                    set of permutations")
        intersection = np.count_nonzero(self.hashvalues==other.hashvalues)
        raw_est = float(intersection) / float(self.hashvalues.size)
        a1 = self._calc_a(self.r, self.b)
        a2 = self._calc_a(other.r, other.b)
        c1, c2 = self._calc_c(a1, a2, self.r, other.r)
        return (raw_est - c1) / (1 - c2)
def jaccard(self, other):
        '''
        Estimate the Jaccard similarity (resemblance) between this b-bit
        MinHash and the other.
        '''
        if self.b != other.b:
            raise ValueError("Cannot compare two b-bit MinHashes with different\
                    b values")
        if self.seed != other.seed:
            raise ValueError("Cannot compare two b-bit MinHashes with different\
                    set of permutations")
        intersection = np.count_nonzero(self.hashvalues==other.hashvalues)
        raw_est = float(intersection) / float(self.hashvalues.size)
        a1 = self._calc_a(self.r, self.b)
        a2 = self._calc_a(other.r, other.b)
        c1, c2 = self._calc_c(a1, a2, self.r, other.r)
        return (raw_est - c1) / (1 - c2)
def jaccard ( self , other ) : if self . b != other . b : raise ValueError ( "Cannot compare two b-bit MinHashes with different\
                    b values" ) if self . seed != other . seed : raise ValueError ( "Cannot compare two b-bit MinHashes with different\
                    set of permutations" ) intersection = np . count_nonzero ( self . hashvalues == other . hashvalues ) raw_est = float ( intersection ) / float ( self . hashvalues . size ) a1 = self . _calc_a ( self . r , self . b ) a2 = self . _calc_a ( other . r , other . b ) c1 , c2 = self . _calc_c ( a1 , a2 , self . r , other . r ) return ( raw_est - c1 ) / ( 1 - c2 )
Estimate the Jaccard similarity (resemblance) between this b-bit
        MinHash and the other.
Estimate the Jaccard similarity ( resemblance ) between this b - bit MinHash and the other .