Skip to content

Commit 0840418

Browse files
committed
Replace min.inf by float(inf)
1 parent d5ded33 commit 0840418

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

algorithms/ml/nearest_neighbor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ def distance(x,y):
1717
for component in result:
1818
sum += component**2
1919
return math.sqrt(sum)
20-
20+
2121

2222
def nearest_neighbor(x, tSet):
2323
"""[summary]
24-
Implements the nearest neighbor algorithm
24+
Implements the nearest neighbor algorithm
2525
2626
Arguments:
2727
x {[tupel]} -- [vector]
2828
tSet {[dict]} -- [training set]
29-
29+
3030
Returns:
3131
[type] -- [result of the AND-function]
3232
"""
3333
assert isinstance(x, tuple) and isinstance(tSet, dict)
3434
current_key = ()
35-
min_d = math.inf
35+
min_d = float('inf')
3636
for key in tSet:
3737
d = distance(x, key)
3838
if d < min_d:
3939
min_d = d
4040
current_key = key
41-
return tSet[current_key]
41+
return tSet[current_key]

0 commit comments

Comments
 (0)