Share via


VectorSearchAlgorithmMetric Class

public final class VectorSearchAlgorithmMetric
extends ExpandableStringEnum<VectorSearchAlgorithmMetric>

The similarity metric to use for vector comparisons. It is recommended to choose the same similarity metric as the embedding model was trained on.

Field Summary

Modifier and Type Field and Description
static final VectorSearchAlgorithmMetric COSINE

Measures the angle between vectors to quantify their similarity, disregarding magnitude.

static final VectorSearchAlgorithmMetric DOT_PRODUCT

Calculates the sum of element-wise products to gauge alignment and magnitude similarity.

static final VectorSearchAlgorithmMetric EUCLIDEAN

Computes the straight-line distance between vectors in a multi-dimensional space.

static final VectorSearchAlgorithmMetric HAMMING

Only applicable to bit-packed binary data types.

Constructor Summary

Constructor Description
VectorSearchAlgorithmMetric()

Deprecated

Use the fromString(String name) factory method.

Creates a new instance of VectorSearchAlgorithmMetric value.

Method Summary

Modifier and Type Method and Description
static VectorSearchAlgorithmMetric fromString(String name)

Creates or finds a VectorSearchAlgorithmMetric from its string representation.

static Collection<VectorSearchAlgorithmMetric> values()

Gets known VectorSearchAlgorithmMetric values.

Methods inherited from ExpandableStringEnum

Methods inherited from java.lang.Object

Field Details

COSINE

public static final VectorSearchAlgorithmMetric COSINE

Measures the angle between vectors to quantify their similarity, disregarding magnitude. The smaller the angle, the closer the similarity.

DOT_PRODUCT

public static final VectorSearchAlgorithmMetric DOT_PRODUCT

Calculates the sum of element-wise products to gauge alignment and magnitude similarity. The larger and more positive, the closer the similarity.

EUCLIDEAN

public static final VectorSearchAlgorithmMetric EUCLIDEAN

Computes the straight-line distance between vectors in a multi-dimensional space. The smaller the distance, the closer the similarity.

HAMMING

public static final VectorSearchAlgorithmMetric HAMMING

Only applicable to bit-packed binary data types. Determines dissimilarity by counting differing positions in binary vectors. The fewer differences, the closer the similarity.

Constructor Details

VectorSearchAlgorithmMetric

@Deprecated
public VectorSearchAlgorithmMetric()

Deprecated

Use the fromString(String name) factory method.

Creates a new instance of VectorSearchAlgorithmMetric value.

Method Details

fromString

public static VectorSearchAlgorithmMetric fromString(String name)

Creates or finds a VectorSearchAlgorithmMetric from its string representation.

Parameters:

name - a name to look for.

Returns:

the corresponding VectorSearchAlgorithmMetric.

values

public static Collection<VectorSearchAlgorithmMetric> values()

Gets known VectorSearchAlgorithmMetric values.

Returns:

known VectorSearchAlgorithmMetric values.

Applies to