Repository navigation
Conversation
This is the first step in making base tree "regressor" be used by all the tree classifiers. Next step is to make the implementation generic over the used Criterion with callers deciding it. Add a Criterion trait with MSE and Gini implementations in src/tree/criterion.rs. Use MeanStats in BaseTreeRegressor in place of explicit sum/mass bookkeeping. - Store node stats in NodeVisitor; remove true/false_child_output - Keep scratch stats in SplitWorkspace to avoid new allocations - Rank splits by proxy improvement; store the real impurity improvement in split_score - Pass the sample count to find_best_cutoff and check min_samples_split at the caller
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #492 +/- ##
===========================================
+ Coverage 43.97% 85.62% +41.64%
===========================================
Files 85 97 +12
Lines 7281 9396 +2115
===========================================
+ Hits 3202 8045 +4843
+ Misses 4079 1351 -2728 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks @slievens. Centralising the sufficient statistics in one place is a good direction, and recomputing child leaf values from Process
Possible behaviour changes in
Tests and evidence
Design
Happy to re-review after the retarget and the empty-range fix. |
|
Thanks @slievens, moving the regressor onto a Possible behaviour changes (please verify)
Tests
Scope and project conventions
Nits
Happy to re-review once 1 and 2 are clarified. |
Make sure no leaf has a split_core. Add tests to check this. Also check that no "proxy" values are leftover by verifying that the sum of all split_scores adds up to the total impurity decrease.
1.
|
|
Thanks @slievens. I read the current diff (head Still open from the previous reviews
New points
After the golden test and the benchmark are in, I am happy to approve. |
- Compute the MSE improvement as (S_T·M_F − S_F·M_T)² / (M_T·M_F·M_P). This prevents cancellation for targets with a large offset. - Remove rows with mass 0 in grow(). Zero-weight rows no longer count toward min_samples_leaf/min_samples_split and do not move thresholds. - Remove the MASS_EPS clamp from difference(). - In split(), add the false side directly instead of parent − true. - Add tests for target-offset invariance and zero-weight rows.
tree: Criterion trait with numerically stable MSE split improvementFixes #491 Checklist
Current behaviour
When the targets have a large offset compared to their spread (for example
New expected behaviour
Change logsAdded
Changed
|
|
This looks good. This is a relevant change in API for developers so my idea is to keep this for version 0.7. Let me know. I will deal into preparing the release in the next weeks, together with the other features already in the queue. |
Tree-based models: planned workI would like to continue working on the tree-based classifiers. Things I still would like to do:
QuestionIf you agree that these changes are worthwhile, where should I implement them? If different branches are used, we will get a lot of merge conflicts. |
|
you can open different sequential PRs and specify "Depends on #..." |

This is the first step in making base tree "regressor" be used by all the tree classifiers. Next step is to make the implementation generic over the used Criterion with callers deciding it.
Add a Criterion trait with MSE and Gini implementations in src/tree/criterion.rs. Use MeanStats in BaseTreeRegressor in place of explicit sum/mass bookkeeping.
Fixes #491
Checklist
Current behaviour
BaseTreeRegressor has hardcoded MSE stats.
New expected behaviour
BaseTreeRegressor uses a MSECriterion.
Change logs
Added