rename variable

This commit is contained in:
onyx-and-iris 2024-01-17 18:16:56 +00:00
parent adf9534443
commit c2dab280ac

View File

@ -30,10 +30,10 @@ def knn(point: Point, neighbours):
neighbour.distance = np.linalg.norm(point.array - neighbour.array) neighbour.distance = np.linalg.norm(point.array - neighbour.array)
logger.debug(f"{neighbour.identifier}: {neighbour.distance}") logger.debug(f"{neighbour.identifier}: {neighbour.distance}")
average = 0 total = 0
for n in sorted(neighbours, key=lambda x: x.distance)[:K]: for n in sorted(neighbours, key=lambda x: x.distance)[:K]:
average += n.sold total += n.sold
return average / K return total / K
neighbours = [ neighbours = [