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

Turi Create API


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

Compute the “transformed_dot_product” distance between two dictionaries or two lists of equal length. This is a way to transform the dot product of the two inputs—a similarity measure—into a distance measure. Suppose x andy each contain \(d\) variables:

\[D(x, y) = \log\{1 + \exp\{-\sum_i^d x_i y_i\}\}\]

Warning

The ‘dot_product’ distance is deprecated and will be removed in future versions of Turi Create. Please use ‘transformed_dot_product’ distance instead, although note that this is more than a name change; it is a different transformation of the dot product of two vectors. Please see the distances module documentation for more details.

Parameters: x : dict or list First input vector. y : dict or list Second input vector.
Returns: out : float

Notes

Examples

tc.distances.transformed_dot_product([1, 2, 3], [4, 5, 6]) 0.03125 ... tc.distances.transformed_dot_product({'a': 2, 'c': 4}, {'b': 3, 'c': 12}) 0.020833333333333332