NearPy
NearPy copied to clipboard
Mismatch between docstring and functionality
There is at least one mismatch that I'm noticing right now. Specifically, the functionality specified in the docstring of Engine
doesn't match what happens.
For example, in engine.py
, you say:
There are four different modes of the engine:
. . .
2) No distance - The distance argument is None.
In this case only the vector filters are applied to
the bucket contents and the result is a list of
filtered (vector, data) tuples.
But you're specifically replacing all incoming None
arguments with default values:
def __init__(self, ...):
#. . .
if distance is None: distance = CosineDistance()
self.distance = distance
Then, in Engine.neighbors
, you check for self.distance
being None and execute based on that:
def neighbors(self, v):
#. . .
# Apply distance implementation if specified
if self.distance:
candidates = self._append_distances(v, self.distance, candidates)
@braingineer Yeah that's weird. Will check where that line with CosineDistance() is coming from