Explore Library
Code QuizIntermediate

Gradient Boosting Residual Fitting

Finding the sign mistake when fitting a tree to residuals.

Codepython
def fit_next(model, X, y, current_pred):
    # fit the next tree to the current residuals
    residuals = current_pred - y
    model.fit(X, residuals)
    return model

What is the bug in this residual-fitting step?