mirror of
https://github.com/onyx-and-iris/grokking-algorithms.git
synced 2024-11-15 17:30:52 +00:00
rename variable
This commit is contained in:
parent
adf9534443
commit
c2dab280ac
@ -30,10 +30,10 @@ def knn(point: Point, neighbours):
|
||||
neighbour.distance = np.linalg.norm(point.array - neighbour.array)
|
||||
logger.debug(f"{neighbour.identifier}: {neighbour.distance}")
|
||||
|
||||
average = 0
|
||||
total = 0
|
||||
for n in sorted(neighbours, key=lambda x: x.distance)[:K]:
|
||||
average += n.sold
|
||||
return average / K
|
||||
total += n.sold
|
||||
return total / K
|
||||
|
||||
|
||||
neighbours = [
|
||||
|
Loading…
Reference in New Issue
Block a user