Getting started¶
floky
exposes Python
bindings to the LSH implementation of lsh-rs. An LSH
implementation in Rust
. floky
is therefore blazingly fast.
Below shows how you can get started with floky
.
from floky import SRP
import numpy as np
N = 10000
n = 100
dim = 10
# Generate some random data points
data_points = np.random.randn(N, dim)
# Do a one time (expensive) fit.
lsh = SRP(n_projections=19, n_hash_tables=10)
lsh.fit(data_points)
# Query approximated nearest neigbors in sub-linear time
query = np.random.randn(n, dim)
results = lsh.predict(query)