Skip to content

ENH Add categorical support for IsolationForest - #13

Open
adam2392 wants to merge 2 commits into
feat/cat-forestfrom
feat/cat-iforest
Open

adam2392 wants to merge 2 commits into
feat/cat-forestfrom
feat/cat-iforest

Conversation

@adam2392

Copy link
Copy Markdown
Owner

Reference Issues/PRs

Stacked on scikit-learn#34832.
Towards: scikit-learn#33965

What does this implement/fix? Explain your changes.

Adds native categorical support to IsolationForest via categorical_features, on top of the random forest and extra trees support in scikit-learn#34832.

IsolationForest builds its trees through Bagging, so this PR passes the resolved categorical mask and precomputed category counts into each tree from _parallel_build_estimators. The forest encodes once. warm_start refits with categorical features raise, same as the other forests.

AI usage disclosure

This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.

I used AI assistance for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)

Any other comments?

Depends on scikit-learn#34832. Review this after that PR, or as a stack on feat/cat-forest.

Made with Cursor

Encode once in the forest and pass category counts through bagging so each tree does not re-encode.

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant