Skip to main content

Locality-sensitive hashing to implement K nearesr neighbors fast.

Project description


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

# 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.

Files for HashedKNN, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size HashedKNN-1.0.0-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page