turicreate.toolkits.distances.euclidean¶
-
turicreate.toolkits.distances.
euclidean
(x, y)¶ Compute the Euclidean distance between two dictionaries or two lists of equal length. Suppose x and y each contain \(d\) variables:
\[D(x, y) = \sqrt{\sum_i^d (x_i - y_i)^2}\]Parameters: - x : dict or list
First input vector.
- y : dict or list
Second input vector.
Returns: - out : float
Euclidean distance between x and y.
Notes
- If the input vectors are in dictionary form, keys missing in one of the two dictionaries are assumed to have value 0.
References
Examples
>>> tc.distances.euclidean([1, 2, 3], [4, 5, 6]) 5.196152422706632 ... >>> tc.distances.euclidean({'a': 2, 'c': 4}, {'b': 3, 'c': 12}) 8.774964387392123