OBXVectorDistanceType class abstract

The vector distance algorithm used by an HNSW index (vector search).

Constructors

OBXVectorDistanceType()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

Cosine → const int
Cosine similarity compares two vectors irrespective of their magnitude (compares the angle of two vectors). Often used for document or semantic similarity. Value range: 0.0 - 2.0 (0.0: same direction, 1.0: orthogonal, 2.0: opposite direction)
DotProduct → const int
For normalized vectors (vector length == 1.0), the dot product is equivalent to the cosine similarity. Because of this, the dot product is often preferred as it performs better. Value range (normalized vectors): 0.0 - 2.0 (0.0: same direction, 1.0: orthogonal, 2.0: opposite direction)
DotProductNonNormalized → const int
A custom dot product similarity measure that does not require the vectors to be normalized. Note: this is no replacement for cosine similarity (like DotProduct for normalized vectors is). The non-linear conversion provides a high precision over the entire float range (for the raw dot product). The higher the dot product, the lower the distance is (the nearer the vectors are). The more negative the dot product, the higher the distance is (the farther the vectors are). Value range: 0.0 - 2.0 (nonlinear; 0.0: nearest, 1.0: orthogonal, 2.0: farthest)
Euclidean → const int
The default; typically "Euclidean squared" internally.
Hamming → const int
Manhattan → const int
Unknown → const int
Not a real type, just best practice (e.g. forward compatibility)