A regression tree chooses a threshold and constant predictions to minimize the squared-error criterionwhere ranges over thresholds producing two nonempty groups. For a fixed split, the least-squares minimizers are the two sample means,Thus the first split is the candidate threshold with the smallest sum of the two within-node residual sums of squares.
With , it suffices to put the threshold between and for . Form the prefix sumsThey take operations to compute. The minimized squared errors for the two children areandEach candidate value therefore takes constant time once the prefix sums are available. Scanning all candidates takes operations in the sense of Big O notation, and retaining the minimizing gives the optimal split.
WriteThe ordinary least squares estimators givewhereThe denominator is positive because the sorted inputs are distinct and .
For each , the displayed objective is the sum of the minimized linear-regression residual sums of squares on the prefix and suffix . Precompute prefix sums ofThis requires operations. The corresponding five sums over a suffix are obtained by subtracting a prefix sum from the total.
For any block of observations, these raw sums give in constant timeBy the formula for the residual sum of squares in simple linear regression, its minimized loss isHence both losses for a proposed take constant time. Evaluating their sum for and keeping the minimum is another scan, so the complete minimization uses computations.
Articles by others on the same topic
There are currently no matching articles.