Skip to content

Integrate scikit-learn's set_output method into TransactionEncoder #1085

@it176131

Description

@it176131

Describe the workflow you want to enable

In scikit-learn version 1.2, the set_output API was introduced. I would like to expose the API inside of the mlxtend.preprocessing.transactionencoder.TransactionEncoder class. This would allow the user to set the output of :method:TransactionEncoder.fit_transform and :method:TransactionEncoder.transform to a pandas.DataFrame by default, rather than having to manually create the object after transformation.

Describe your proposed solution

My proposed solution is to define the :method:get_feature_names_out in :class:TransactionEncoder as this is required to expose the :method:set_output. See :class:TransformerMixin and Developer API for set_output for more details.

Describe alternatives you've considered, if relevant

Continue using the method described in the User Guide—convert the output of the transformer to a pandas.DataFrame manually.

Additional context

  • This would require the minimum version of scikit-learn to increase from 1.0.2 to 1.2.2.
  • I'm willing to take on the PR for this work.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions