Skip to content

refactor(tree): share LAST split criterion - #2000

Open
Siege-Cobby wants to merge 1 commit into
online-ml:mainfrom
Siege-Cobby:global-last-split-criterion
Open

Siege-Cobby wants to merge 1 commit into
online-ml:mainfrom
Siege-Cobby:global-last-split-criterion

Conversation

@Siege-Cobby

@Siege-Cobby Siege-Cobby commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Addresses #1612.

This refactors LASTClassifier so distribution-tracking leaves no longer retain a separate split-criterion instance.

Before this change, when track_error=False, each LAST leaf stored its own persistent Gini or Information Gain criterion. A tree with N leaves therefore retained N monitoring criteria.

This PR moves that monitoring criterion to the tree level:

  • one lazily initialized criterion is retained per LAST tree
  • leaves access the tree-owned criterion through _change_detector_merit
  • track_error=True behavior is unchanged
  • track_error=False behavior is unchanged
  • split evaluation still creates its own temporary criterion, preserving the existing split-attempt lifecycle
  • Hellinger restrictions remain unchanged

Tests cover:

  • error-tracking detector inputs
  • Gini and Information Gain distribution tracking
  • reuse of the single tree-owned criterion
  • absence of per-leaf split_criterion
  • deterministic predictions and tree structure
  • Hellinger behavior

No public API changes are introduced.

@codspeed

codspeed Bot commented Sep 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 98 untouched benchmarks
⏩ 16 skipped benchmarks1


Comparing Siege-Cobby:global-last-split-criterion (47de90b) with main (b50439f)

Open in CodSpeed

Footnotes

  1. 16 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Siege-Cobby
Siege-Cobby marked this pull request as ready for review September 16, 2026 10:35
@MaxHalford

Copy link
Copy Markdown
Member

Hello @smastelini 👋

Would you mind taking this one?

@smastelini

Copy link
Copy Markdown
Member

Hi there! Yeap, I can check it out 😃

I will review it soon!

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.

3 participants