LogitBoost boosts with the log loss by taking a Newton step at every round, so each weak learner solves a weighted least-squares problem. The model is .
Implement logitboost_fit(X, y, M, z_max=4.0) for labels , starting from (so ). For :
x[feature] <= threshold with a constant on each side equal to the weighted mean of on that side. Candidate thresholds are, for each feature in increasing order, the midpoints between consecutive distinct sorted values, in increasing order; keep the first split found on ties (lowest feature, then lowest threshold).Return (stumps, losses): stumps is a list of (feature, threshold, left_value, right_value) tuples (Python floats except the int feature), and losses the mean training log loss after each round.
Also implement logitboost_predict_proba(stumps, X) returning for every row.