Skip to content

Categorical splits are classifier/regressor-only; forest, Bagging and ExtraTree builders and traversals ignore cat_kind #457

Closed

Description

@godofecht

Follow-up from #354 / PR #441, where this was scoped out deliberately and flagged only in a comment on the now-closed issue.

Current state, verified on main

TreeNode carries cat_kind and cat_mask0..3, and the two plain builders (decision_tree_classifier_fit_categorical, decision_tree_regressor_fit_categorical) plus their predict paths honour them. grep cat_kind lib/scikit/ensemble.flow returns nothing: the RandomForest, Bagging and ExtraTree builders never set it, and ensemble.flow's three inline node-traversal sites evaluate every node as a threshold split.

This is currently safe — node arrays are calloc'd (#403), so every node those builders produce has cat_kind == 0 and traversals behave correctly. But it means the headline feature of #441 (native categorical handling, the most-repeated community complaint the project catalogues) is unavailable exactly where sklearn users most want it: forests.

What a fix needs

Cross-reference: #441 for the representation and the allocation-size audit discipline (the struct is 52 bytes, allocated at 64 — any new array of TreeNode must match).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions