turicreate.toolkits.distances.jaccard — Turi Create API 6.4.1 documentation (original) (raw)

Turi Create API

Turi Create API


turicreate.toolkits.distances. jaccard(x, y)

Compute the Jaccard distance between between two dictionaries. Suppose \(K_x\) and \(K_y\) are the sets of keys from the two input dictionaries.

\[D(x, y) = 1 - \frac{|K_x \cap K_y|}{|K_x \cup K_y|}\]

Parameters: x : dict First input dictionary. y : dict Second input dictionary.
Returns: out : float Jaccard distance between x and y.

Notes

References

Examples

tc.distances.jaccard({'a': 2, 'c': 4}, {'b': 3, 'c': 12}) 0.6666666666666667