-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MAINT] Modularize Tree code and Splitter utility functions #22753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The functions in As part of my initiative to reduce the code in |
I agree, and I would be in favour of making use libcpp as much as possible. This can be through renaming and extending |
I see that makes sense and would be awesome! In that case, would it be desirable to replace the existing usage of |
I'm working on replacing sort all together. It requires minor refactoring of the splitter internals and benchmarks to make sure there are no performance regressions. |
Oh awesome! That'll make the diff even smaller in obliquePR. Lmk if you need any help with that. |
FYI, I just have opened #22760. |
From #20819 , developers expressed issues with the current tree code.
Part of that is the modularity and as a result, maintainability/upgradability of such code. I propose the following super-short refactors to the
_tree.pyx/pxd
and_splitter.pyx/pxd
files. This would be the first in a series of PRs to demonstrate that #20819 is fairly straightforward.Tree class
The Tree class assumes axis-aligned splits. However, by modularizing the parts where the node values are set, and the feature values are computed for any given dataset, then any subclass of Tree can easily redefine only these two functions and a new
Splitter
to enable a "new" type of Tree.I propose adding the following two functions to the
Tree
class and altering_add_node()
,_apply_dense
to accompany these changes:Splitter
Splitter uses functions only defined in the
.pyx
files. As a result, they are not available viacimport
. This poses an issue for #20819 and also for downstream packages that might want to define a new splitter that subclassesSplitter
.Here I propose adding the following functions into the
_splitter.pxd
file:The text was updated successfully, but these errors were encountered: