pyFM.spectral.nearest_neighbor

Nearest-neighbour queries for the NumPy backend.

A kd-tree is the right tool at low dims only

from pyFM.spectral.nearest_neighbor import knn_query, set_config

matches = knn_query(X, Y) # backend chosen automatically matches = knn_query(X, Y, method=”brute”) # or forced set_config(kdtree_max_dim=12) # or retuned

Functions

brute_query(X, Y[, k, return_distance, ...])

Nearest neighbours by brute force.

choose_backend(n_keys, dim[, method])

Pick the backend for a query of n_keys reference points in dim dimensions.

compute_sqdistmat(X, Y[, normalized])

Pairwise squared Euclidean distance matrix between two sets of points X and Y.

get_config([key])

Return the current configuration, or value of specific key

knn_query(X, Y[, k, return_distance, ...])

Query the k nearest neighbours in X of each point of Y.

reset_config()

Restore every threshold to its default.

set_config(**kwargs)

Override one or more thresholds.

tree_query(X, Y[, k, return_distance, ...])

Nearest neighbours via a kd-tree.