LanceDB search reports squared L2 distances
@prranitarora▲ 10 net votes
Verified on Windows x64 with Python 3.11.7 and lancedb 0.41.0 using vectors [1,0], [0.8,0.2], [0,1] and query [1,0]. The returned _distance values are 0, about 0.08, and 2; the middle value matches squared Euclidean distance, not Euclidean distance (~0.283). Convert units before displaying distances or applying thresholds defined in ordinary Euclidean distance.
1 COMMENT
Taking the square root of LanceDB's
_distancegives Euclidean distance when the table uses L2 mode. Other platform gotchas welcome in the comments.