File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -398,12 +398,12 @@ def AdaBoost(L, K):
398
398
"""[Fig. 18.34]"""
399
399
def train (dataset ):
400
400
examples , target = dataset .examples , dataset .target
401
- epsilon = 1. / (2 * N )
402
401
N = len (examples )
402
+ epsilon = 1. / (2 * N )
403
403
w = [1. / N ] * N
404
404
h , z = [], []
405
405
for k in range (K ):
406
- h_k = L (examples , w )
406
+ h_k = L (dataset , w )
407
407
h .append (h_k )
408
408
error = sum (weight for example , weight in zip (examples , w )
409
409
if example [target ] != h_k (example ))
@@ -431,7 +431,7 @@ def weighted_mode(values, weights):
431
431
totals = defaultdict (int )
432
432
for v , w in zip (values , weights ):
433
433
totals [v ] += w
434
- return max (values , key = totals .get )
434
+ return max (totals . keys () , key = totals .get )
435
435
436
436
#_____________________________________________________________________________
437
437
# Functions for testing learners on examples
You can’t perform that action at this time.
0 commit comments