Skip to content

Conversation

@AnneBeyer
Copy link
Contributor

Reference Issues/PRs

Fixes #32719

What does this implement/fix? Explain your changes.

It adds a simple check to Pipeline, FeatureUnion and ColumnTransformer to raise a clearer error message if the user accidentally passed a class instead of an instance, and provides corresponding non-regression test.

AI usage disclosure

I used AI assistance for:

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

Any other comments?

As noted in my comment here, it could also be added to the existing _validate_estimator() function in _BaseHeterogeneousEnsemble and its version in StackingClassifier in a follow-up PR. If I followed the class hierarchy correctly, then this would also catch this mistake in StackingClassifier, StackingRegressor, VotingClassifier and VotingRegressor. I didn't check the other meta-estimators yet.

@AnneBeyer AnneBeyer changed the title Validate estimators FIX add clearer error message when instance is passed instead of class Dec 11, 2025
@AnneBeyer AnneBeyer changed the title FIX add clearer error message when instance is passed instead of class ENH add clearer error message when instance is passed instead of class Dec 11, 2025
@AnneBeyer
Copy link
Contributor Author

I suppose the changelog is not checked because it is not in one of the labelled modules?

@StefanieSenger
Copy link
Member

StefanieSenger commented Dec 11, 2025

I suppose the changelog is not checked because it is not in one of the labelled modules?

The changelog fails because the action also checks the correct naming of the file. Fizzy thing, but instead of enhancement.32888.rst it needs to be 32888.enhancement.rst. 🤷

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.

Failure to insert instantiated class of estimator in Pipeline produces an unclear error message

2 participants