scikit-learn / scikit-learn/scikit-learn

TransformedTargetClassifier

Open
#20,952 11 comments 7 reactions 1 assignee View on GitHub

@gtauzin is already working on this.

Since Sep 28, 2024.

module:preprocessing Needs Decision - Include Feature New Feature
Dominant language
Python
Stars
67.3k
Forks
27.4k
Avg merge
1d 15h
Merged PRs (30d)
58

Description

Describe the workflow you want to enable

I would like to be able to use a LabelEncoder as a wrapper for a classifier, similarly to what can be achieved with preprocessors on the y value for regressors via the TransformedTargetRegressor.

Describe your proposed solution

Add a class TransformedTargetClassifier that accepts both a transformer on y and a classifier.

Describe alternatives you've considered, if relevant

An alternative would be to use the voting classifier with a single estimator, but that appears to be misusing that class.

Additional context

I'm proposing this feature because in Auto-sklearn we use the LabelEncoder on a call to fit to have all classifiers we try use a simple, encoded representation. When using the Auto-sklearn classes we can undo the transformations ourselves. However, if the user would like to access an individual model, there's no way we can wrap the LabelEncoder around this models.

CC @eddiebergman

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.