Classification trees group labels; regression trees group real-valued targets. A good numeric leaf is one whose targets can be represented by a single useful number, so this version measures spread rather than class mixing. The split search and recursion stay familiar, but leaves must predict means and predictions must remain floating-point values.
Implement variance, variance_reduction, find_best_regression_split, build_regression_tree, and predict_regression_tree. Theory translates each classification-tree operation into its continuous-target counterpart.
targets are real-valued; empty targets have variance 0.0.None without a positive reduction.float(np.mean(targets)), never a class vote.Open one at a time. Each gives away a little more than the last.
Everything about candidate thresholds is the same as the classification tree; only the node-quality measure changes.
np.var gives the population variance required here. For an empty input, return before calling it.
No results yet
Run your code to check it against the examples, or submit to run every test.