You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no where in the documentation that explains what method is used to identify which values to consider as candidate splits. For example, for regression, an exhaustive method would be to sort each feature and then use the halfway point between each feature value. In this case there would be O(N*F) candidate splits where N=# data and F= # features. Another way would be to randomly choose K values between the min and max of each feature.
Does anyone know what method is used? Could someone point me to where in the code this occurs?
@howarth just to be clear , you were unable to find the methods for evaluating candidate splits , correct?
@Snerdify I was able to find documentation on the split criterion methods like entropy, gini, etc. What I could not find was documentation on how the set of candidate values is populated for each feature (the set of values for which you compute the split criterion, and then take the max or min). In my initial post I gave two example methods that are commonly used, but I don’t know if either of those are use, or if another is used.
What I’m actually trying to understand is the computational complexity of creating a single node. To know that I need to know how many splits are calculated at each node.
@howarth Current Approach:
Scikit-learn's decision tree implementation uses the "best split" strategy as the default approach to identify candidate splits. This means that for each feature, all unique values present in the training data are considered as potential splitting points. The criterion (e.g., Gini impurity or entropy) is computed for each unique value, and the value that maximizes the reduction in impurity is selected as the splitting point for that feature.
Alternative/Fix:
If you are interested in an alternative approach for selecting candidate splits, you could consider using the "random split" strategy. In this approach, you randomly choose a subset of candidate values from the feature's range and evaluate the criterion for each of those values. This can significantly reduce the computational complexity, especially for features with a large number of unique values.
@howarth , @AyushChauhan-ui , in the scikit-learn documentation , there is no detailed documentation for gini, variance reduction (which is used for regression trees) , entropy, information gain . Also there is one more splitting method we could add called chi-square splitting method.
Also the complexity that is mentioned is for binary trees and nothing specific about what is the computational complexity for particular decision tree algorithms like CART , ID3. That could be added too.
@howarth , @AyushChauhan-ui , in the scikit-learn documentation , there is no detailed documentation for gini, variance reduction (which is used for regression trees) , entropy, information gain .
[...] for regression, an exhaustive method would be to sort each feature and then use the halfway point between each feature value. In this case there would be O(N*F) candidate splits where N=# data and F= # features. Another way would be to randomly choose K values between the min and max of each feature.
Also the complexity that is mentioned is for binary trees and nothing specific about what is the computational complexity for particular decision tree algorithms like CART , ID3. That could be added too.
While complexity is interesting, it will not give you the info about the splitter. Also the original question was something about random forest while here we are speaking decision tree.
Improve the user guide (https://scikit-learn.org/stable/modules/tree.html#tree) of the decision tree such that we explain the best/random search. As far I can say, the requested information by @howarth could have been made explicit in the first paragraph of the "Mathematical formulation". This section is kind of written having the best splitter in mind, so we would need to either create a section or rework the narrative. I would see a section for finding the best split (the current narrative is nice) and add that split candidate are assessed exhaustively by a brute-force approach. Then, in the next section, I would explain the random approach simply by stating that we pick up a single split candidate randomly by feature.
An important point while modifying the documentation is to keep it as simple as possible and as succinct as possible as well.
Hi, I’m interested in working on this issue. This would be my first contribution to scikit-learn. Could you please confirm if it’s still open for contribution and assign it to me? Thanks!
I strongly recommend reading #27159 (comment) before creating a PR. It explains what changes are required and in which files they should be made.
Taking the time to read it is definitely worthwhile. Even if you still have questions afterwards, it will help you better frame your confusion so we can assist you or review your PR more effectively.
First-time contributor here—a first-year CS student learning ML through Kaggle and exploring GSoC 2026. This docs issue looks like a great starter, but I'm a bit confused on the technical details—could someone clarify if it's exhaustive sorting of unique values (O(N*F)) or random selection?
I'd love to work on this if it's still available. My plan:
Research the split method in _forest.py or _splitter.py.
Add 2-3 sentences to ensemble.rst explaining the approach.
Test docs build and verify.
Reference any related PRs/commits if needed.
Any guidance on the confusion or code locations would be super helpful! Thanks for the welcoming community—excited to contribute!
Activity
Snerdify commentedon Aug 25, 2023
I'm working on this
Snerdify commentedon Aug 26, 2023
@howarth just to be clear , you were unable to find the methods for evaluating candidate splits , correct?
Snerdify commentedon Aug 26, 2023
/take
howarth commentedon Aug 26, 2023
@Snerdify I was able to find documentation on the split criterion methods like entropy, gini, etc. What I could not find was documentation on how the set of candidate values is populated for each feature (the set of values for which you compute the split criterion, and then take the max or min). In my initial post I gave two example methods that are commonly used, but I don’t know if either of those are use, or if another is used.
What I’m actually trying to understand is the computational complexity of creating a single node. To know that I need to know how many splits are calculated at each node.
Snerdify commentedon Aug 26, 2023
@howarth got it. Working on it
AyushChauhan-ui commentedon Aug 27, 2023
@howarth
Current Approach:
Scikit-learn's decision tree implementation uses the "best split" strategy as the default approach to identify candidate splits. This means that for each feature, all unique values present in the training data are considered as potential splitting points. The criterion (e.g., Gini impurity or entropy) is computed for each unique value, and the value that maximizes the reduction in impurity is selected as the splitting point for that feature.
Alternative/Fix:
If you are interested in an alternative approach for selecting candidate splits, you could consider using the "random split" strategy. In this approach, you randomly choose a subset of candidate values from the feature's range and evaluate the criterion for each of those values. This can significantly reduce the computational complexity, especially for features with a large number of unique values.
Code Location:
If you want to delve into the code to understand how candidate splits are identified, you can look into the _splitter.pyx file in scikit-learn's source code. This file contains the core logic for finding the best split in decision trees. Specifically, you can explore the
BestSplitterclass, where the process of finding the best split point is implemented. You can find this here:https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/tree/_splitter.pyx
howarth commentedon Aug 28, 2023
@AyushChauhan-ui thank you!
Snerdify commentedon Aug 29, 2023
@howarth , @AyushChauhan-ui , in the scikit-learn documentation , there is no detailed documentation for gini, variance reduction (which is used for regression trees) , entropy, information gain . Also there is one more splitting method we could add called chi-square splitting method.
Snerdify commentedon Aug 29, 2023
Also the complexity that is mentioned is for binary trees and nothing specific about what is the computational complexity for particular decision tree algorithms like CART , ID3. That could be added too.
bmreiniger commentedon Sep 2, 2023
https://scikit-learn.org/stable/modules/tree.html#mathematical-formulation
bmreiniger commentedon Sep 3, 2023
It's the former. See e.g.
scikit-learn/sklearn/tree/_splitter.pyx
Line 472 in a05eb6b
I don't think it's essential to spell this out in the User Guide, but I also don't think it would hurt. There have been some alternatives used, like left or right endpoints instead of midpoints, see e.g. https://datascience.stackexchange.com/q/32638/55122
Also, uniform selection in the feature range is used, e.g. in IsolationForests.
glemaitre commentedon Sep 16, 2023
Scikit-learn implements CART. This is indeed a decision tree and the complexity for nodes, and tree is specified there: https://scikit-learn.org/stable/modules/tree.html#complexity.
While complexity is interesting, it will not give you the info about the splitter. Also the original question was something about random forest while here we are speaking decision tree.
So I see several documentation improvement:
RandomForestClassifierandRandomForestRegressorto make it obvious that the decision tree used under the hood are usingsplitter="best". DOC improve RandomForest docstring by explicitely stating the splitter strategy used #27746RandomForestRegressordocstring is wrong because it refers to decision tree classifiers instead of regressors (it should be corrected as well). DOC: RandomForestClassifier depends on DecisionTreeClassifier, not DecsionTreeRegressor #30035An important point while modifying the documentation is to keep it as simple as possible and as succinct as possible as well.
9 remaining items
madhav758 commentedon Sep 8, 2025
Hi, I’m interested in working on this issue. This would be my first contribution to scikit-learn. Could you please confirm if it’s still open for contribution and assign it to me? Thanks!
balaraj74 commentedon Sep 11, 2025
VIVEK-MARRI commentedon Sep 11, 2025
Pakhi424 commentedon Sep 14, 2025
Hi, I’m new to open source and would like to contribute to this documentation issue. Could you please assign it to me if possible?
virchan commentedon Sep 16, 2025
For potential contributors to this issue:
I strongly recommend reading #27159 (comment) before creating a PR. It explains what changes are required and in which files they should be made.
Taking the time to read it is definitely worthwhile. Even if you still have questions afterwards, it will help you better frame your confusion so we can assist you or review your PR more effectively.
Edit: typo
CodeMudit commentedon Sep 21, 2025
Hi @scikit-learn-team!
First-time contributor here—a first-year CS student learning ML through Kaggle and exploring GSoC 2026. This docs issue looks like a great starter, but I'm a bit confused on the technical details—could someone clarify if it's exhaustive sorting of unique values (O(N*F)) or random selection?
I'd love to work on this if it's still available. My plan:
Any guidance on the confusion or code locations would be super helpful! Thanks for the welcoming community—excited to contribute!
lucaEaton commentedon Sep 21, 2025
/take
MBARKI-Omar commentedon Sep 23, 2025
ArturoAmorQ commentedon Sep 23, 2025
FYI I removed the "good first issue" tag as an experiment to see if that reduces the number of bots trying to address it.
ArturoAmorQ commentedon Oct 7, 2025
I guess its easier if I address this issue. Will submit a PR later today.