Skip to content

Commit e6c9b29

Browse files
committed
Tweak: use generator comprehension.
1 parent 0c0999f commit e6c9b29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

learning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def predict(example):
206206
"Find the k closest, and have them vote for the best."
207207
best = heapq.nsmallest(k, ((dataset.distance(e, example), e)
208208
for e in dataset.examples))
209-
return mode([e[dataset.target] for (d, e) in best])
209+
return mode(e[dataset.target] for (d, e) in best)
210210
return predict
211211

212212
#______________________________________________________________________________

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy