All Products
Search
Document Center

Tablestore:VectorMetricType

Last Updated:Feb 05, 2025

VectorMetricType specifies the algorithm that you want to use to measure the distance between vectors.

Enumeration value list

  • VM_EUCLIDEAN: the Euclidean distance algorithm that measures the shortest path between two vectors in a multi-dimensional space. The Euclidean distance algorithm in Tablestore does not perform the final square root calculation to achieve better performance. A greater value that is obtained by using the Euclidean distance algorithm indicates a higher similarity between two vectors.

  • VM_COSINE: the cosine similarity algorithm that calculates the cosine of the angle between two vectors in a vector space. A greater value that is obtained by using the cosine similarity algorithm indicates a higher similarity between two vectors. In most cases, the algorithm is used to calculate the similarity between text data.

  • VM_DOT_PRODUCT: the dot product algorithm that multiplies the corresponding coordinates of two vectors of the same dimension and adds the products. A greater value that is obtained by using the dot product algorithm indicates a higher similarity between two vectors.

enum VectorMetricType {
    VM_EUCLIDEAN = 0;
    VM_COSINE = 1;
    VM_DOT_PRODUCT = 2;
}