Skip to content

daft.functions.euclidean_distance#

euclidean_distance #

euclidean_distance(left: Expression, right: Expression) -> Expression

Compute the Euclidean distance between two embeddings.

Parameters:

Name Type Description Default
left FixedSizeList or Embedding Expression

The left vector

required
right FixedSizeList or Embedding Expression

The right vector

required

Returns:

Name Type Description
Expression Float64 Expression

the Euclidean distance between the two vectors.

Source code in daft/functions/distance.py
55
56
57
58
59
60
61
62
63
64
65
def euclidean_distance(left: Expression, right: Expression) -> Expression:
    """Compute the Euclidean distance between two embeddings.

    Args:
        left (FixedSizeList or Embedding Expression): The left vector
        right (FixedSizeList or Embedding Expression): The right vector

    Returns:
        Expression (Float64 Expression): the Euclidean distance between the two vectors.
    """
    return Expression._call_builtin_scalar_fn("euclidean_distance", left, right)