Finding why only the last tree affects the boosted prediction.
Codepython
import numpy as np
def predict_ensemble(trees, X, init, learning_rate):
pred = np.full(len(X), init)
for tree in trees:
# accumulate each tree's contribution
pred = learning_rate * tree.predict(X)
return pred