MCPcopy Create free account
hub / github.com/dblalock/bolt / knn

Function knn

experiments/python/utils.py:123–126  ·  view source on GitHub ↗
(X, q, k, dist_func=dists_sq)

Source from the content-addressed store, hash-verified

121
122
123def knn(X, q, k, dist_func=dists_sq):
124 dists = dist_func(X, q)
125 idxs = top_k_idxs(dists, k)
126 return idxs, dists[idxs]
127
128
129@_memory.cache

Callers

nothing calls this directly

Calls 1

top_k_idxsFunction · 0.70

Tested by

no test coverage detected