Skip to content

Commit

Permalink
Fixed the measure of vector search
Browse files Browse the repository at this point in the history
  • Loading branch information
jieguangzhou committed Jan 23, 2025
1 parent 9b466dc commit f4d5379
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Bug Fixes

- Fix the random silent failure bug when ibis creates tables.
- Fixed the measure of vector search

## [0.5.0](https://github.com/superduper-io/superduper/compare/0.5.0...0.4.0]) (2024-Nov-02)

Expand Down
4 changes: 3 additions & 1 deletion superduper/backends/base/vector_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ def l2(x, y):
:param x: numpy.ndarray
:param y: numpy.ndarray
"""
return numpy.array([-numpy.linalg.norm(x - y, axis=1)])
result = numpy.array([numpy.linalg.norm(x - y, axis=1)])
result = 1 / (1 + result)
return result


def dot(x, y):
Expand Down
1 change: 1 addition & 0 deletions superduper/backends/local/vector_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__(
assert isinstance(measure, str)

self.measure_name = measure
self._measure = measure
self.measure = measures[measure]

self.h = None
Expand Down

0 comments on commit f4d5379

Please sign in to comment.