File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed
objectbox-java-api/src/main/java/io/objectbox/annotation Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -29,5 +29,35 @@ public enum HnswDistanceType {
2929 /**
3030 * Typically "Euclidean squared" internally.
3131 */
32- EUCLIDEAN
32+ EUCLIDEAN ,
33+
34+ /**
35+ * Cosine similarity compares two vectors irrespective of their magnitude (compares the angle of two vectors).
36+ * <p>
37+ * Often used for document or semantic similarity.
38+ * <p>
39+ * Value range: 0.0 - 2.0 (0.0: same direction, 1.0: orthogonal, 2.0: opposite direction)
40+ */
41+ COSINE ,
42+
43+ /**
44+ * For normalized vectors (vector length == 1.0), the dot product is equivalent to the cosine similarity.
45+ * <p>
46+ * Because of this, the dot product is often preferred as it performs better.
47+ * <p>
48+ * Value range (normalized vectors): 0.0 - 2.0 (0.0: same direction, 1.0: orthogonal, 2.0: opposite direction)
49+ */
50+ DOT_PRODUCT ,
51+
52+ /**
53+ * A custom dot product similarity measure that does not require the vectors to be normalized.
54+ * <p>
55+ * Note: this is no replacement for cosine similarity (like DotProduct for normalized vectors is). The non-linear
56+ * conversion provides a high precision over the entire float range (for the raw dot product). The higher the dot
57+ * product, the lower the distance is (the nearer the vectors are). The more negative the dot product, the higher
58+ * the distance is (the farther the vectors are).
59+ * <p>
60+ * Value range: 0.0 - 2.0 (nonlinear; 0.0: nearest, 1.0: orthogonal, 2.0: farthest)
61+ */
62+ DOT_PRODUCT_NON_NORMALIZED
3363}
You can’t perform that action at this time.
0 commit comments