python NGT
Project description
python NGT
Install
Python binding with pybind11 (ngtpy) is installed as follows.
pip3 install ngt
You can install the python bindings from source code. You MUST install the NGT library according to the README before installing the python bindings as follows.
pip3 install pybind11
pip3 install numpy
cd NGT_ROOT/python
python3 setup.py sdist
pip3 install dist/ngt-x.x.x.tar.gz
Please note that the search speed of the ngtpy packages from PyPI is slower than that of the ngtpy that is built on your computer so that the package can be run on older CPUs.
Documents
Simple samples
ngtpy (pybind11)
ngtpy(pybind11) can reduce the processing times than ngt(ctypes). It is more effective especially for the short search time.
import ngtpy
import random
dim = 10
nb = 100
vectors = [[random.random() for _ in range(dim)] for _ in range(nb)]
query = vectors[0]
ngtpy.create(b"tmp", dim)
index = ngtpy.Index(b"tmp")
index.batch_insert(vectors)
index.save()
results = index.search(query, 3)
for i, (id, distance) in enumerate(results) :
print(str(i) + ": " + str(id) + ", " + str(distance))
object = index.get_object(id)
print(object)
See also sample.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for ngt-2.1.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8a0f33533377f8b0a9738f630ffe28ced0932fc393cf5d01bc4aaf7614f40ac |
|
MD5 | fab7a33f23d9a6db1d37df8f08746c58 |
|
BLAKE2b-256 | 3ca4639f995435375f5012713ba88ddca2df8a4011e7db6841ad729d81f49eca |
Close
Hashes for ngt-2.1.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b4f4acd435ba656810c3bb99fd9a4a3a20d78dbf8c2050b9027aa2d6f43fa6d |
|
MD5 | 24f27f8f31dfd426ea3b448abba8de88 |
|
BLAKE2b-256 | a1f3616db9af31711ac8dc875af4a1e97709d6fc5607914475794dc68cc8edee |
Close
Hashes for ngt-2.1.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8475293cf61121a4a494e36d32f825b5e77d945ae576e44b1c8d7716be8b41e6 |
|
MD5 | 27d4ffc0f788310210d0e00d8ee7ce98 |
|
BLAKE2b-256 | 0a51e21ddadad298b713038421473498ee8596d565a90397b24985b08f4e680d |
Close
Hashes for ngt-2.1.3-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1af651c3a33139b87bb96cf9ef692e2bdcdbd7a6962ee3a6069e302699d7cd58 |
|
MD5 | 9e021022d4eb8f657a714a2fb3a8b834 |
|
BLAKE2b-256 | 0192535c410925a32b91570ec7ba4ff52f8d2d736b52baf23ccd389de44a1117 |
Close
Hashes for ngt-2.1.3-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d45ced9e6f48c6812e9816cd5ae53feb1d75f63d463e2a427cd331d77b548be9 |
|
MD5 | 5f8156839db468a7fbeee38deed72e46 |
|
BLAKE2b-256 | 7e89f58ac1a893bd94957cabadb9d6985d74f2022029772dc5dc79c7f209d496 |
Close
Hashes for ngt-2.1.3-cp37-cp37m-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e3e45fb100323d89cc2168f1b256fcb7fb5747090902beea5414aa1bcb7479e |
|
MD5 | d5fb9adb24a02e402b3f39ca47837d2c |
|
BLAKE2b-256 | d48667e2c465e3c3a0b96856cf3a0e57b1f662a614c3dcfbcbd0d216d0a6d3a6 |
Close
Hashes for ngt-2.1.3-cp36-cp36m-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62668898f6dfd023ec8292df004aa9b35b910ad72e96abec2e4418a6566e8ec1 |
|
MD5 | 9cb545f949293df6a39b72478ca2fb4b |
|
BLAKE2b-256 | de767c87f38bc0c9333a2bb0f453af8da8c912398a9d8e85a12f89130eb1ef29 |