Repository navigation
v0.7 Release - #504
Merged
Merged
v0.7 Release#504
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
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.
- 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.
Add compute_feature_importances (mean decrease in impurity, as in scikit-learn) to DecisionTreeRegressor, RandomForestRegressor and ExtraTreesRegressor. The forests normalize the importances of each tree, take the mean and normalize again. The fitted models store new fields (root_mass, num_features), so models serialized with an earlier version do not deserialize.
BaseTree only finds the leaf. DecisionTreeRegressor and BaseForestRegressor convert the leaf output to TY.
The forest passes a Criterion to its trees. The predict methods are restricted to Output = f64. The RF and ET regressors use MSECriterion.
BaseForest only gives access to its trees and samples. The mean of the tree predictions is in predict_mean and predict_mean_oob.
BaseTree and BaseForest do not store the criterion. Only the type of the leaf value is kept in the tree. Make the types generic over this output type and move the Criterion type parameter to the fit functions. Move output_approximate_eq from Criterion to a new LeafOutput trait on the output type.
…into make-generic
…oml, ci.yml and CHANGELOG
…e: resolve CHANGELOG
This was referenced Oct 24, 2026
This was referenced Oct 24, 2026
Add feature importances to DecisionTreeRegressor, RandomForestRegressor and ExtraTreesRegressor
#497
Closed
Collaborator
Author
|
These changes are merged into the v0.7 release candidate on |
Contributor
|
Nice! Thanks for considering and adopting lazymatrix! Please let me know if you find any issues or have any feature requests for new functionality in lazymatrix. |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Integration PR for the v0.7 release candidate. It merges the outstanding
v0.7-labelled PRs into one owned branch so the conflicts between them are resolved once, in one place:BaseTree/BaseForestover criterion and leaf outputAlso includes:
ndarrayrequirement bumped to0.17.2, and all unreleased changes consolidated under a[v0.7]section inCHANGELOG.md(the current release candidate), with an empty[Unreleased]above it.Already merged to
mainseparately: #503 (docs), #490 (cargo-deny/audit CI), #472 (ndarray conditional std).Conflict resolutions
CHANGELOG.md: rebuilt the unreleased section as[v0.7]; entries grouped Added/Changed, breaking changes flagged..github/workflows/ci.yml: combined feature matrix entries (std,ndarray-bindings,lazy-normalization*) and the Testsifcondition.Cargo.toml: keptndarraydefault-features = false(from feat: make ndarray std support conditional #472) together with the newlazymatrixdependency (from feat: add lazy normalization for Lasso and Elastic Net #480).Verification
cargo test --all-features --release: 674 passed, 0 failed (+ doctests and integration suites green)cargo fmt --all -- --checkandcargo clippy --all-features -- -Drust-2018-idioms -Drust-2024-compatibility -Dwarningspass (pre-commit)After merge
#480, #492, #497 and #502 will be closed as superseded by this PR; their commits keep the original authorship via rebase merge.