Skip to content

DOC VotingClassifier: clarify that estimators_ are fitted on integer-encoded labels - #33722

Merged
jeremiedbb merged 1 commit into
scikit-learn:mainfrom
RudrenduPaul:fix/voting-classifier-le-docstring
May 13, 2026
Merged

jeremiedbb merged 1 commit into
scikit-learn:mainfrom
RudrenduPaul:fix/voting-classifier-le-docstring

Conversation

@RudrenduPaul

@RudrenduPaul RudrenduPaul commented Apr 11, 2026 •

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #12189

What does this implement/fix? Explain your changes.

VotingClassifier.estimators_ is documented as "the collection of fitted sub-estimators" but does not mention that sub-estimators are always fitted on integer-encoded labels (via le_), not on the original class labels. This surprises users who expect to call estimators_[i].predict() and receive the same label type as the original y.

This PR adds a note to estimators_ and expands the le_ docstring so both attributes cross-reference each other. The change is documentation-only with no behaviour changes.

Before (estimators_ docs):

The collection of fitted sub-estimators as defined in estimators that are not 'drop'.

After:

The collection of fitted sub-estimators as defined in estimators that are not 'drop'.
Note that sub-estimators are always fitted on integer-encoded labels (see le_ attribute).
When y contains non-integer class labels (e.g. strings), use le_.inverse_transform to
map predictions back to the original label space.

Any other comments?

Documentation-only change. No tests added (no behaviour change). Follows the existing docstring style in this file.


AI Assistance Disclosure (required per AGENTS.md)
This pull request includes code written with the assistance of AI (Claude Code).
All changes have been read, understood, and verified by the human contributor (Rudrendu Paul).

…ed labels

Sub-estimators are always trained on LabelEncoder-transformed integer
labels. Document this in estimators_ and cross-reference le_ so users
understand why calling estimators_[i].predict() directly returns integers
rather than the original class labels.

Fixes: scikit-learn#12189

Built by Rudrendu Paul, developed with Claude Code

@jeremiedbb jeremiedbb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jeremiedbb
jeremiedbb merged commit d1d726e into scikit-learn:main May 13, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VotingClassifier estimators_ are based on transformed labels

2 participants