simpleneighbors
simpleneighbors copied to clipboard
The dist function should work with vectors and it does not
The following code does not work
from simpleneighbors import SimpleNeighbors
sim = SimpleNeighbors(2, 'angular')
sim.feed([('a', (4, 5)),
('b', (0, 3)),
('c', (-2, 8)),
('d', (2, -2))])
sim.build()
print(list(sim.nearest_matching((1, -1), n=1,
check=lambda x: sim.dist((1, -1), x) < 0.5)))
Even if we provide the full item it does not work
from simpleneighbors import SimpleNeighbors
sim = SimpleNeighbors(2, 'angular')
sim.feed([('a', (4, 5)),
('b', (0, 3)),
('c', (-2, 8)),
('d', (2, -2))])
sim.build()
print(list(sim.nearest_matching((1, -1), n=1,
check=lambda x: sim.dist(('k', (1, -1)), x) < 0.5)))
Yep, this would be a helpful feature that is currently missing from the library.