turicreate.toolkits.distances.jaccard¶
-
turicreate.toolkits.distances.
jaccard
(x, y)¶ Compute the Jaccard distance between between two dictionaries. Suppose Kx and Ky are the sets of keys from the two input dictionaries.
D(x,y)=1−|Kx∩Ky||Kx∪Ky|Parameters: - x : dict
First input dictionary.
- y : dict
Second input dictionary.
Returns: - out : float
Jaccard distance between x and y.
Notes
- Jaccard distance treats the keys in the input dictionaries as sets, and ignores the values in the input dictionaries.
References
Examples
>>> tc.distances.jaccard({'a': 2, 'c': 4}, {'b': 3, 'c': 12}) 0.6666666666666667