Skip to content

DOC add set_output custom transformer example#34141

Open
faizzyhon wants to merge 1 commit into
scikit-learn:mainfrom
faizzyhon:doc-set-output-custom-transformer-example
Open

DOC add set_output custom transformer example#34141
faizzyhon wants to merge 1 commit into
scikit-learn:mainfrom
faizzyhon:doc-set-output-custom-transformer-example

Conversation

@faizzyhon
Copy link
Copy Markdown

Reference Issues/PRs

Closes #26460.

What does this implement/fix? Explain your changes.

Adds a small custom transformer example to the developer set_output API docs. The example shows how a transformer with one-to-one input/output features can inherit from OneToOneFeatureMixin, TransformerMixin, and BaseEstimator so that set_output(transform="pandas") preserves the input feature names in the pandas output.

AI usage disclosure

I used AI assistance for:

  • Documentation (including examples)
  • Research and understanding

Any other comments?

Local checks run:

  • git diff --check
  • codespell doc/developers/develop.rst
  • Ran the added example as a standalone Python snippet against the released scikit-learn package and confirmed it returns a pandas DataFrame with ['height', 'weight'] columns.

I did not run a full local documentation build because the cloned source tree is not built in this environment and the Sphinx documentation dependencies were not installed.

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.

Pandas set_output Development and Customer Transformers Best Practice

2 participants