I am trying to build a binary classification model using Sklearn DecisionTreeClassifier(). The first variable it selects doesn't make business sense. I would like to force the first 1 or 2 variables for splits after which the algorithm can choose any variable it wants. Is there a way to do this?
Asked
Active
Viewed 412 times
1
-
Not really a feature available in the built-in version, but [this question](https://stackoverflow.com/questions/46579186/how-can-i-specify-splits-in-decision-tree) has soe suggestions for workarounds in the answers, and if you really need the functionality, the source code for the classifier is [here](https://github.com/scikit-learn/scikit-learn/blob/95119c13a/sklearn/tree/_classes.py#L607), you could make a modified version yourself – G. Anderson Mar 09 '21 at 20:59
-
Does this answer your question? [How can I specify splits in decision tree?](https://stackoverflow.com/questions/46579186/how-can-i-specify-splits-in-decision-tree) – Ben Reiniger Mar 10 '21 at 01:58