-
Notifications
You must be signed in to change notification settings - Fork 294
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
Updated knn #1626
Updated knn #1626
Conversation
Specifies the data type of the embedding vector. Commonly used types (values) include: | ||
|
||
- `"float"` | ||
- `"int"`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int=>uint8
table_obj.knn('col1', [0.1,0.2,0.3], 'float', 'l2', 100) | ||
``` | ||
|
||
```python | ||
ef = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
erase
# Find the 2 nearest neighbors using inner product distance | ||
table_obj.knn('vec', [3.0] * 5, 'float', 'ip', 2) | ||
# If you use HNSW index, you can set ef in knn_params | ||
table_obj.knn('vec', [3.0] * 5, 'float', 'ip', 2, {"ef": str(ef)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[3.0] * 5=> [0.1, 0.2, 0.3]
# Find the 2 nearest neighbors using inner product distance | ||
table_obj.knn('vec', [3.0] * 5, 'float', 'ip', 2) | ||
# If you use HNSW index, you can set ef in knn_params | ||
table_obj.knn('vec', [3.0] * 5, 'float', 'ip', 2, {"ef": str(ef)}) | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one more example:
table_obj.knn('vec', [1, 2, 3], 'uint8', 'cosine', 2, {"ef": "100"})
What problem does this PR solve?
Issue link:#1490
Type of change