Skip to main content

A package implementing a vantage-point data structure, for efficient nearest neighbor searching.

Project description

This package contains an implementation of a vantage-point tree data structure.

Installation

Simply install through pip:

pip install vptree

Example

Example usage:

import numpy as np
import vptree

# Define distance function.
def euclidean(p1, p2):
  return np.sqrt(np.sum(np.power(p2 - p1, 2)))

# Generate some random points.
points = np.random.randn(20000, 10)
query = [.5] * 10

# Build tree in O(n log n) time complexity.
tree = vptree.VPTree(points, euclidean)

# Query single point.
tree.get_nearest_neighbor(query)

# Query n-points.
tree.get_n_nearest_neighbors(query, 10)

# Get all points within certain distance.
tree.get_all_in_range(query, 3.14)

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

vptree-1.1.1.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file vptree-1.1.1.tar.gz.

File metadata

  • Download URL: vptree-1.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for vptree-1.1.1.tar.gz
Algorithm Hash digest
SHA256 1221be5ed7c680a81da695c948fe32ff1da5a9a2e1fe8301b398926160dfa47d
MD5 7106a9a920c98916d49830a346e83b17
BLAKE2b-256 4b363aa3a196e791ca37cc08a29d22e9601e665ae873d17c256dd142e0525221

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