horapy
1.0.0
[Página de inicio] [Documento] [Ejemplos] [Hora]
Enlace de Python para la Hora Approximate Nearest Neighbor Search
Artista ⚡️
Soporte de múltiples índices
Hierarchical Navigable Small World Graph Index(HNSWIndex)
(detalle)Satellite System Graph (SSGIndex)
(detalle)Product Quantization Inverted File(PQIVFIndex)
(detalle)Random Projection Tree(RPTIndex)
(LSH, WIP)BruteForce (BruteForceIndex)
(implementación ingenua con SIMD)Portátil
no_std
(WIP, parcial)Windows
, Linux
y OS X
IOS
y Android
(WIP)BLAS
Fiabilidad
Rust
protege todo el códigoRust
¿Soporte para múltiples distancias ?
Dot Product Distance
Euclidean Distance
Manhattan Distance
Cosine Similarity
Productivo
por aws t2.medium (CPU: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz)
más información
pip install horapy
import numpy as np
from horapy import HNSWIndex
dimension = 50
n = 1000
# init index instance
index = HNSWIndex ( dimension , "usize" )
samples = np . float32 ( np . random . rand ( n , dimension ))
for i in range ( 0 , len ( samples )):
# add node
index . add ( np . float32 ( samples [ i ]), i )
index . build ( "euclidean" ) # build index
target = np . random . randint ( 0 , n )
# 410 in Hora ANNIndex <HNSWIndexUsize> (dimension: 50, dtype: usize, max_item: 1000000, n_neigh: 32, n_neigh0: 64, ef_build: 20, ef_search: 500, has_deletion: False)
# has neighbors: [410, 736, 65, 36, 631, 83, 111, 254, 990, 161]
print ( "{} in {} n has neighbors: {}" . format (
target , index , index . search ( samples [ target ], 10 ))) # search
Todo el repositorio está bajo licencia Apache.