Skip to main content

k nearest neighbor (KNN) graphs via Pearson correlation distance and local sensitive hashing (LSH).

Project description

k nearest neighbor (KNN) graphs via Pearson correlation distance and local sensitive hashing (LSH).

import numpy as np
import lshknn

# Make mock data
# 2 features (rows), 4 samples (columns)
data = np.array(
        [[1, 0, 1, 0],
         [0, 1, 0, 1]],
        dtype=np.float64)

# Instantiate class
c = lshknn.Lshknn(
        data=data,
        k=1,
        threshold=0.2,
        m=10,
        slice_length=4)

# Call subroutine
knn, similarity, n_neighbors = c()

# Check result
assert (knn == [[2], [3], [0], [1]]).all()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lshknn-0.1.2.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file lshknn-0.1.2.tar.gz.

File metadata

  • Download URL: lshknn-0.1.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lshknn-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1a96208c0b43ce8f818d48bf02cb4c46549910001ba0f1122db9b5f71dd01f3e
MD5 6beb1856bb08c5f54f219eaeacf0b323
BLAKE2b-256 dbd1bf6b93f62eeaafb33fcb0edcf802b35f30e60dd616c0c24e7c656ce113fa

See more details on using hashes here.

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