pyFM.spectral.nearest_neighbor.choose_backend

pyFM.spectral.nearest_neighbor.choose_backend(n_keys, dim, method='auto')

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

KDtree is only useful in low dim with enough points to search.

Parameters:
  • n_keys (int) – Number of reference points, n1 (the set being searched).

  • dim (int) – Dimension p of the embedding.

  • method (str) – “auto”, “tree” or “brute”. Anything but “auto” forces that backend.

Returns:

backend – One of tree_query() or brute_query().

Return type:

callable