Native categorical splitting enhancements in DecisionTree, ExtraTree, RandomForest and ExtraTrees
Author: adam2392Created May 10, 2026Updated Sep 28, 2026
LabelsNew FeatureHardmodule:tree
[!WARNING] This issue is not yet ready for a PR. If you are interested in contributing to scikit-learn, please have a look at our contributing guidelines, and in particular the sections for new contributors and the "Needs triage" label.
Describe the workflow you want to enable
From: https://github.com/scikit-learn/scikit-learn/pull/33354#issue-3973551384, we want to enable:
- [Optimization] Add a bitset cache (i.e. a uint64_t memory view) that allows us to compute the category split as we traverse the tree for inference speedup
- [Feature] Support in tree-based ensemble models (RF + ExtraTrees). This could be done after for random splitter support, so we do all the classes at once: https://github.com/scikit-learn/scikit-learn/pull/34832/
- [Refactor] Consolidate the goes_left operation to work at inference time too: https://github.com/scikit-learn/scikit-learn/pull/33972
- [Refactor] Understand the bitset operations and merge these with the HistGradientBoosting bitset operations https://github.com/scikit-learn/scikit-learn/pull/33354)
- [Feature] Implement categorical splitting for RandomSplitter for ExtraTrees. Pretty easy now that we have an arbitrary sized bitset, which we can expand to hold many categories in the case of a randomized tree: https://github.com/scikit-learn/scikit-learn/pull/33972
- [Feature] Add support for categorical in exporting
- [Feature] Add internal ordinal encoding support for any kind of "categorical input" (see https://github.com/scikit-learn/scikit-learn/pull/33354#discussion_r3199995969)
- [Refactor] Address refactoring to use ColumnTransformer in tree, similar to HGBT: https://github.com/scikit-learn/scikit-learn/pull/33354#discussion_r3521665892
- Add warm_start capability with categorical_features (see: https://github.com/scikit-learn/scikit-learn/pull/34832#discussion_r4003388745_)
Below the line for priority:
- [Feature] Brute-force search; expands categorical support to multi-class and multi-output problems
- [Feature] Add support for sparse categorical splitting with best and random splitter
Describe your proposed solution
These work streams may not all be relevant, or mergable, but we can explore.
Source: scikit-learn/scikit-learn