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

Feature: Add Python documentation regarding how to search with custom metrics with more than two variables #451

Open
2 of 3 tasks
lnmduc2 opened this issue Jul 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@lnmduc2
Copy link

lnmduc2 commented Jul 22, 2024

As i looked around on the documentation for Python SDK, custom metrics having more than 2 variables are not shown how to perform search() operation. Specifically, when using masked-L2 metric, at run time (after indexing the vectors) one might need a query vector and a binary mask, as can be seen in this function:

def masked_l2_distance(a, b, mask):
    a_array = carray(a, dims)
    b_array = carray(b, dims)
    mask_array = carray(mask, dims)
    distance = 0.0
    for i in range(dims):
        if mask_array[i]:
            diff = a_array[i] - b_array[i]
            distance += diff * diff
    return distance

How do I plug in the query vector and its binary mask to perform the search?

Can you contribute to the implementation?

  • I can contribute

Is your feature request specific to a certain interface?

Python bindings

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@lnmduc2 lnmduc2 added the enhancement New feature or request label Jul 22, 2024
@lnmduc2 lnmduc2 changed the title Feature: Add documentation regarding how to search with custom metrics with more than two variables Feature: Add Python documentation regarding how to search with custom metrics with more than two variables Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant