Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Align metrics #30

Merged
merged 9 commits into from
Dec 1, 2024
Merged

feat: Align metrics #30

merged 9 commits into from
Dec 1, 2024

Conversation

Pringled
Copy link
Member

No description provided.

@Pringled Pringled requested a review from stephantul November 29, 2024 15:59
@Pringled Pringled changed the title Align metrics feat: Align metrics Nov 29, 2024
@Pringled Pringled marked this pull request as ready for review November 30, 2024 14:49
@codecov-commenter
Copy link

codecov-commenter commented Nov 30, 2024

Codecov Report

Attention: Patch coverage is 87.25490% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
vicinity/backends/annoy.py 83.33% 3 Missing ⚠️
vicinity/backends/pynndescent.py 78.57% 3 Missing ⚠️
vicinity/backends/faiss.py 88.88% 2 Missing ⚠️
vicinity/backends/usearch.py 81.81% 2 Missing ⚠️
vicinity/utils.py 90.00% 2 Missing ⚠️
vicinity/backends/hnsw.py 91.66% 1 Missing ⚠️
Files with missing lines Coverage Δ
vicinity/__init__.py 100.00% <100.00%> (ø)
vicinity/backends/base.py 84.37% <100.00%> (+1.32%) ⬆️
vicinity/backends/basic.py 78.12% <100.00%> (-12.20%) ⬇️
vicinity/backends/hnsw.py 95.31% <91.66%> (-2.97%) ⬇️
vicinity/backends/faiss.py 94.91% <88.88%> (ø)
vicinity/backends/usearch.py 96.92% <81.81%> (ø)
vicinity/utils.py 95.74% <90.00%> (-4.26%) ⬇️
vicinity/backends/annoy.py 95.06% <83.33%> (+0.12%) ⬆️
vicinity/backends/pynndescent.py 95.65% <78.57%> (-1.13%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Contributor

@stephantul stephantul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think the exceptions to the inverse mapping from metric to string can be set in the respective backends, but that's not a blocker for me.

e.g.,

class Backend:

     inverse_metric_mapping = {Metric.EUCLIDEAN: "l2"}

You can then find a generalizable solution in the form of a method on the base class:

def _map_metric_to_string(self, metric: Metric) -> str:
     return self.inverse_metric_mapping.get(metric, metric.value)

@Pringled Pringled merged commit ba2bc67 into main Dec 1, 2024
5 checks passed
@Pringled Pringled deleted the align-metrics branch December 11, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants