VectorMetric uses ConstantsTrait
The vector similarity metrics, used both as the `metric` value of a {@see \oihana\arango\clients\collection\indexes\VectorIndex} and to select the approximate-nearest-neighbour function in {@see \oihana\arango\db\operations\aqlVectorSearch()}.
The metric of a query must match the metric of the index covering the attribute.
Tags
Table of Contents
Constants
- COSINE : string = 'cosine'
- Angular similarity (`APPROX_NEAR_COSINE`). Vectors are normalized; sort `DESC`, closer to 1 is nearer.
- INNER_PRODUCT : string = 'innerProduct'
- Similarity in terms of angle and magnitude (introduced in ArangoDB v3.12.6). Vectors are not normalized.
- L2 : string = 'l2'
- Euclidean distance (`APPROX_NEAR_L2`). Sort `ASC`, closer to 0 is nearer.
Constants
COSINE
Angular similarity (`APPROX_NEAR_COSINE`). Vectors are normalized; sort `DESC`, closer to 1 is nearer.
public
string
COSINE
= 'cosine'
INNER_PRODUCT
Similarity in terms of angle and magnitude (introduced in ArangoDB v3.12.6). Vectors are not normalized.
public
string
INNER_PRODUCT
= 'innerProduct'
Note: there is no APPROX_NEAR_* function for this metric, so it is not selectable in aqlVectorSearch().
L2
Euclidean distance (`APPROX_NEAR_L2`). Sort `ASC`, closer to 0 is nearer.
public
string
L2
= 'l2'