VP-Tree
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)
Metadata
Release files for vptree 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vptree-1.1.1.tar.gz | 4.1 kB | Details |
Release files / vptree-1.1.1.tar.gz
| Download URL | vptree-1.1.1.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1221be5ed7c680a81da695c948fe32ff1da5a9a2e1fe8301b398926160dfa47d
|
|
BLAKE2b-256 checksum How to use checksums |
4b363aa3a196e791ca37cc08a29d22e9601e665ae873d17c256dd142e0525221
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |