Skip to main content

Locality-sensitive hashing to implement K nearesr neighbors fast.

Project description

HasedKNN

LSH based KNN inspired from LSH Attention (Reformer: The Efficient Transformer)

Last Stable Release

$ pip install hashedknn

Usage example

From a jupyter notebook run

import HashedKNN

# Fetch dataset
from sklearn.datasets import fetch_openml
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)

# Run LSH based KNN
knn = HasedKNN(bucket_size=8, number_of_universes=20)

# Fit
knn.fit(X)

# Find ID's of 10 nearest neighbors
id = knn.find(vectorIdx=10, corpus=X, k=10)

Project details


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 Distribution

HashedKNN-1.0.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page