Estimate the `Jaccard similarity`_ (resemblance) between the sets represented by this MinHash and the other. Args: other (datasketch.MinHash): The other MinHash. Returns: float: The Jaccard similarity, which is between 0.0 and 1.0.
(self, other)
| 175 | self.hashvalues = np.vstack([phv, self.hashvalues]).min(axis=0) |
| 176 | |
| 177 | def jaccard(self, other): |
| 178 | '''Estimate the `Jaccard similarity`_ (resemblance) between the sets |
| 179 | represented by this MinHash and the other. |
| 180 | |
| 181 | Args: |
| 182 | other (datasketch.MinHash): The other MinHash. |
| 183 | |
| 184 | Returns: |
| 185 | float: The Jaccard similarity, which is between 0.0 and 1.0. |
| 186 | ''' |
| 187 | if other.seed != self.seed: |
| 188 | raise ValueError("Cannot compute Jaccard given MinHash with\ |
| 189 | different seeds") |
| 190 | if len(self) != len(other): |
| 191 | raise ValueError("Cannot compute Jaccard given MinHash with\ |
| 192 | different numbers of permutation functions") |
| 193 | return float(np.count_nonzero(self.hashvalues==other.hashvalues)) /\ |
| 194 | float(len(self)) |
| 195 | |
| 196 | def count(self): |
| 197 | '''Estimate the cardinality count based on the technique described in |
no outgoing calls
no test coverage detected