DistanceMetric enum Query Enterprise Edition

A function used to define how close an input query vector is to other vectors within a vector index.

This feature is only available in the Enterprise Edition.

Inheritance
Available extensions

Values

euclidean → const DistanceMetric

Euclidean distance (AKA L2)

This measures the straight-line distance between two points in Euclidean space which is defined by n dimensions, such as x,y,z. This metric focuses on the spatial separation or distance between two vectors. Both the magnitude and direction of the vectors matter. The smaller the distance value, the more similar the vectors are. This differs from euclideanSquared distance by taking the square root of the calculated distance between two point. The result is a "true" geometric distance. You can use this metric when the actual geometric distance matters, such as calculating distance between cities using GPS coordinates.

euclideanSquared → const DistanceMetric

Squared Euclidean distance (AKA Squared L2)

This is the default distance metric. This measures the straight-line distance between two points in Euclidean space which is defined by n dimensions, such as x,y,z. This metric focuses on the spatial separation or distance between two vectors. Both the magnitude and direction of the vectors matter. The smaller the distance value, the more similar the vectors are. You can use this metric to simplify computation in situations where only the relative distance matters, rather than actual distance.

cosine → const DistanceMetric

Cosine distance (1.0 - Cosine Similarity)

This measures the cosine of the angle between two vectors in vector space. This metric focuses on the alignment of two vectors, the similarity of direction. Only the direction of the vectors matter. The smaller the distance value, the more similar the vectors are. You can use this metric when comparing similarity of document content no matter the document size in text similarity or information retrieval applications.

dot → const DistanceMetric

Dot-product distance (Negative of dot-product)

This metric captures the overall similarity by comparing the magnitude and direction of vectors. The result is larger when the vectors are aligned and have large magnitudes and smaller in the opposite case. You can use this metric in recommendation systems to provide users with related content with preference to items the most similar to frequently visited items.

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
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

values → const List<DistanceMetric>
A constant List of the values in this enum, in order of their declaration.