WRITE · TRACE · UNDERSTAND
Fit residual trees in a tiny gradient-boosted regressor
Implement fit_boost(x,y,rounds,rate) and predict_boost(model,x).
Read lesson: Fit residual trees in a tiny gradient-boosted regressor →
Your experiment
Implement fit_boost(x,y,rounds,rate) and predict_boost(model,x). Fit a mean baseline, then squared-error optimal residual stumps at midpoints of distinct x; ties choose smallest cut. Model is dict base, rate, stumps (cut,left,right). Constant x uses a constant residual stump with cut=inf. Validate nonempty equal finite data, rounds>=0 integer, 0<rate<=1.
Python runs in your browser. Your draft stays on this device.
What to look for
A trainable baseline makes every later gain measurable. This tiny learner demonstrates gradient boosting correctly, while production libraries add numerical, categorical, performance and distributed engineering that must be evaluated separately.
Watch your code work
Ready to experimentWrite a solution or load the worked answer, then choose Trace & check.
Step through arrays, variables and training curves produced by your own Python.
