Share via


DistanceFunction Enum

Distance functions for similarity search.

Cosine Similarity the cosine (angular) similarity between two vectors measures only the angle between the two vectors, without taking into account the length of the vectors Cosine Similarity = 1 - Cosine Distance -1 means vectors are opposite 0 means vectors are orthogonal 1 means vectors are identical

Cosine Distance the cosine (angular) distance between two vectors measures only the angle between the two vectors, without taking into account the length of the vectors Cosine Distance = 1 - Cosine Similarity 2 means vectors are opposite 1 means vectors are orthogonal 0 means vectors are identical

Dot Product measures both the length and angle between two vectors same as cosine similarity if the vectors are the same length, but more performant

Euclidean Distance measures the Euclidean distance between two vectors also known as l2-norm

Euclidean Squared Distance measures the Euclidean squared distance between two vectors also known as l2-squared

Manhattan measures the Manhattan distance between two vectors

Hamming number of differences between vectors at each dimensions

Fields

COSINE_DISTANCE
COSINE_SIMILARITY
DOT_PROD
EUCLIDEAN_DISTANCE
EUCLIDEAN_SQUARED_DISTANCE
HAMMING
MANHATTAN