Explore Library
Code QuizIntermediate

AdaBoost Sample Weight Update

Finding the sign error in AdaBoost's weight update step.

Codepython
import numpy as np

def update_weights(w, alpha, y, pred):
    for i in range(len(w)):
        if y[i] == pred[i]:
            w[i] *= np.exp(alpha)      # correctly classified
        else:
            w[i] *= np.exp(-alpha)     # misclassified
    return w / w.sum()

What is the bug in this AdaBoost weight update?