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
Classes DecisionTree* and ExtraTree* are exact copies, the only thing that differentiates them is the default value of the splitter parameter.
I think it's confusing to expose this parameter in the public API, I think DecisionTree*s should always use the "best-splitter" and ExtraTree* should always use the random-splitter.
Why I think it's confusing: because for instance a ExtraTreeRegressor(splitter="best") is absolutely not "An extremely randomized tree regressor" as the doc describes this model. It's just a normal DecisionTreeRegressor(). I was confused about that for a long time, I though that somehow this would still have some randomness in it / a different behavior from a decision tree. I understood it was not the case only by looking at the code.
I suspect this parameter exists for historical reasons: at one point in the past it seems that trees accepted custom splitters. But it's not the case anymore:
Side node: we could also remove some code that handles the case of a custom splitter (see #33150), and the code that allows Splitter subclasses to be serializable (__reduce__, etc.).
I think removing the argument from ExtraTreeClassifier and ExtraTreeRegressor makes sense. Changing the value of splitter doesn't make sense for this class.
However, right now ExtraTree* inherits from DecisionTree* and passes splitter="random" to the constructor. If we remove this constructor argument from DecisionTree* we lose the ability to have this convenient way of making an ExtraTree*. In addition I think it is fine (if a bit strange) for a user to dt = DecisionTreeClassifier(splitter="random").
Why I think it's confusing: because for instance a ExtraTreeRegressor(splitter="random") is absolutely not "An extremely randomized tree regressor" as the doc describes this model.
I think there is a typo here, did you mean ExtraTreeRegressor(splitter="best")?
If we remove this constructor argument from DecisionTree* we lose the ability to have this convenient way of making an ExtraTree*
I think it should be possible to find a convenient way to share the code that can be shared without keeping the splitter parameter for DecisionTree*, but I haven't tried.
Even if we can find a way to avoid the inheritance thing, I think it is a valid use case for a user to "reconfigure" DecisionTree*via the splitter argument. So I'd keep it for decision tree.
Deprecate the splitter parameter.
Implementation: We already have BaseDecisionTree and even DecisionTreeClassifier does almost nothing new on top of it.
Hum, I didn't thought about the option "Deprecate ExtraTree*" but why not indeed.
I made a quick search on github search, and I saw more DecisionTree*(splitter="random") in normal-looking DS/ML projects than ExtraTree*s, so it will probably be less of an inconvenience for most users to deprecate ExtraTree*.
Today I spent some time trying to find out the differences between DecisionTree* v.s. ExtraTree*, thinking that there is some fundamental differences why ExtraTree* cannot be replaced by DecisionTree* with random split and adjusted max_features.
I hope to discover this thread first before anything else.
One reason to have them both is for easier discoverability. For instance, we have LinearRegression, Ridge, Lasso and ElasticNet. In principle, all do the same with different parameters. But this way, if you web search, it is easier to find. Same for ExtraTree*.
Thanks @thariq-nugrohotomo, this clearly shows this is confusing and that we need to do something about it, at the very least documentation (e.g. a note in the splitter parameter docstring about equivalence with DecisionTree*/ExtraTree* if you change it to non default value).
Going through the docs a bit, I'm in favour of deprecating ExtraTreeClassifier/Regressor.
The docstrings of both say
Warning: Extra-trees should only be used within ensemble methods.
and we do have the ensemble versions ExtraTreesClassifier/Regressor (note the s).
From what I understand, in these, we should be able to substitute the ExtraTree template with the corresponding DecisionTree template (note that estimators_ is already described using the latter):
The child estimator template used to create the collection of fitted
sub-estimators.
.. versionadded:: 1.2
`base_estimator_` was renamed to `estimator_`.
estimators_ : list of DecisionTreeClassifier
The collection of fitted sub-estimators.
In the documentation, ExtraTreeClassifier/Regressor is actually only mentioned in the section on Missing Values Support (before, there are only references to the splitter attribute in the sections for Complexity and Mathematical Formulation), and I think this can be reformulated in terms of parameters as well.
I might still be missing things, but currently I don't see any added value (and, as noted above, only unnecessary confusion) in keeping those two.
deprecating splitter in ExtraTree* but not in DecisionTree*. I think this alone is not enough to avoid confusion and doc is also needed.
deprecating splitter in both ExtraTree* and DecisionTree*
deprecating/removing the classes ExtraTree*.
IMO, options 1 and 2 puts too much responsability/cognitive load on the user, and they don't solve well enough the issue.
I personally vote for 4:
+ It reduces the amount of information users have to understand for the same functionalities
+ It reduce the amount of code sklearn/tree/_classes.py
+ It allows cleaner testing/avoids redundant testing.
+ It fixes #34180 for free ;)
- It hurts a bit discoverability, be we still have ExtraTrees* (with an s), which I think is the name people look for most of the time (their pages get 4x more visits than their ExtraTree* siblings).
- It's not aligned with what is done for trees ensemble (RandomForest* and ExtraTrees* with no splitter param)
My second choice is 3:
+ It reduces the amount of information users have to understand for the same functionalities
+ It's aligned with what is done for trees ensemble
+ It allows cleaner testing/avoids redundant testing.
- It probably requires more redundancy in the code and more changes, which might conflict a bit painfully with some other PRs.
- Transition in the doc will be harder (we mention "splitter best/random" in quite a few places).
- It's a bit less convenient for users than being able to switch the splitter param.
But we can still merge the doc PR while waiting for a decision here.
I agree that we should merge #33150 and #34183 as a start. If we decide to go for the deprecation, it will need some more rephrasing and code clean-up, but these already add a bit more clarity in the meantime.
Quick IRL with @ogrisel confirmed this direction (removing deprecating/removing the classes ExtraTree*). @ogrisel do you confirm after reading some more context in this issue?
I agree I am fine with deprecating the redundant ExtraTree{Classifier,Regressor} classes, especially since we received feedback from confused users at several occasions and I agree with the assessment in #33158 (comment).
Note that, this deprecation and then removal will force us to change the type of the trees stored in the estimators_ attribute of the ExtraTreesClassifier/ExtraTreesRegressor ensemble objects. As a consequence, pickled ensembles of extra trees from an older version of scikit-learn will not be loadable anymore, but this was explicitly never guaranteed in our doc.
Activity
betatim commentedon Feb 3, 2026
I think removing the argument from
ExtraTreeClassifierandExtraTreeRegressormakes sense. Changing the value ofsplitterdoesn't make sense for this class.However, right now
ExtraTree*inherits fromDecisionTree*and passessplitter="random"to the constructor. If we remove this constructor argument fromDecisionTree*we lose the ability to have this convenient way of making anExtraTree*. In addition I think it is fine (if a bit strange) for a user todt = DecisionTreeClassifier(splitter="random").I think there is a typo here, did you mean
ExtraTreeRegressor(splitter="best")?cakedev0 commentedon Feb 3, 2026
Oops, typo indeed 😅 Fixed it.
I think it should be possible to find a convenient way to share the code that can be shared without keeping the
splitterparameter forDecisionTree*, but I haven't tried.betatim commentedon Feb 3, 2026
Even if we can find a way to avoid the inheritance thing, I think it is a valid use case for a user to "reconfigure"
DecisionTree*via thesplitterargument. So I'd keep it for decision tree.cakedev0 commentedon Mar 5, 2026
Linking PR discussion here: #32119 (comment). This is a small details that differ between
DecisionTree*andExtraTree*(but for nor apparent reason).Btw, @lorentzenchr I'd love to hear your opinion on this issue 🙏
lorentzenchr commentedon Mar 5, 2026
I am a bit undecided between:
ExtraTree*, it is 100% redundant.splitterparameter.Implementation: We already have
BaseDecisionTreeand evenDecisionTreeClassifierdoes almost nothing new on top of it.cakedev0 commentedon Mar 5, 2026
Hum, I didn't thought about the option "Deprecate
ExtraTree*" but why not indeed.I made a quick search on github search, and I saw more
DecisionTree*(splitter="random")in normal-looking DS/ML projects thanExtraTree*s, so it will probably be less of an inconvenience for most users to deprecateExtraTree*.lorentzenchr commentedon Mar 5, 2026
Be aware that, from experience, I am easier persuaded for a deprecation than other core devs.
thariq-nugrohotomo commentedon Mar 14, 2026
+1 for deprecating
tree.ExtraTree*.Today I spent some time trying to find out the differences between
DecisionTree*v.s.ExtraTree*, thinking that there is some fundamental differences whyExtraTree*cannot be replaced byDecisionTree*with random split and adjustedmax_features.I hope to discover this thread first before anything else.
There are some people in the same boat as me =
lorentzenchr commentedon Mar 14, 2026
One reason to have them both is for easier discoverability. For instance, we have
LinearRegression,Ridge,LassoandElasticNet. In principle, all do the same with different parameters. But this way, if you web search, it is easier to find. Same forExtraTree*.cakedev0 commentedon Mar 16, 2026
Thanks @thariq-nugrohotomo, this clearly shows this is confusing and that we need to do something about it, at the very least documentation (e.g. a note in the splitter parameter docstring about equivalence with
DecisionTree*/ExtraTree*if you change it to non default value).AnneBeyer commentedon Jun 2, 2026
Going through the docs a bit, I'm in favour of deprecating
ExtraTreeClassifier/Regressor.The docstrings of both say
and we do have the ensemble versions
ExtraTreesClassifier/Regressor(note thes).From what I understand, in these, we should be able to substitute the
ExtraTreetemplate with the correspondingDecisionTreetemplate (note thatestimators_is already described using the latter):scikit-learn/sklearn/ensemble/_forest.py
Lines 2184 to 2192 in bd0dbbd
In the documentation,
ExtraTreeClassifier/Regressoris actually only mentioned in the section on Missing Values Support (before, there are only references to thesplitterattribute in the sections for Complexity and Mathematical Formulation), and I think this can be reformulated in terms of parameters as well.I might still be missing things, but currently I don't see any added value (and, as noted above, only unnecessary confusion) in keeping those two.
cakedev0 commentedon Jun 2, 2026
(I was writting this when I read @AnneBeyer message above, I'm happy to see we reached the same conclusion, and for similar reasons 😄👌)
#33568 is one more proof that people are confused by this.
Let's try to move forward. For now, 4 options have been proposed:
ExtraTree*but not inDecisionTree*. I think this alone is not enough to avoid confusion and doc is also needed.ExtraTree*andDecisionTree*ExtraTree*.IMO, options 1 and 2 puts too much responsability/cognitive load on the user, and they don't solve well enough the issue.
I personally vote for 4:
+ It reduces the amount of information users have to understand for the same functionalities
+ It reduce the amount of code
sklearn/tree/_classes.py+ It allows cleaner testing/avoids redundant testing.
+ It fixes #34180 for free ;)
- It hurts a bit discoverability, be we still have
ExtraTrees*(with an s), which I think is the name people look for most of the time (their pages get 4x more visits than theirExtraTree*siblings).- It's not aligned with what is done for trees ensemble (
RandomForest*andExtraTrees*with no splitter param)My second choice is 3:
+ It reduces the amount of information users have to understand for the same functionalities
+ It's aligned with what is done for trees ensemble
+ It allows cleaner testing/avoids redundant testing.
- It probably requires more redundancy in the code and more changes, which might conflict a bit painfully with some other PRs.
- Transition in the doc will be harder (we mention "splitter best/random" in quite a few places).
- It's a bit less convenient for users than being able to switch the splitter param.
But we can still merge the doc PR while waiting for a decision here.
AnneBeyer commentedon Jun 3, 2026
I agree that we should merge #33150 and #34183 as a start. If we decide to go for the deprecation, it will need some more rephrasing and code clean-up, but these already add a bit more clarity in the meantime.
cakedev0 commentedon Jun 12, 2026
Quick IRL with @ogrisel confirmed this direction (removing deprecating/removing the classes
ExtraTree*). @ogrisel do you confirm after reading some more context in this issue?ogrisel commentedon Jun 12, 2026
I agree I am fine with deprecating the redundant
ExtraTree{Classifier,Regressor}classes, especially since we received feedback from confused users at several occasions and I agree with the assessment in #33158 (comment).Note that, this deprecation and then removal will force us to change the type of the trees stored in the
estimators_attribute of theExtraTreesClassifier/ExtraTreesRegressorensemble objects. As a consequence, pickled ensembles of extra trees from an older version of scikit-learn will not be loadable anymore, but this was explicitly never guaranteed in our doc.