rasbt / mlxtend

A library of extension and helper modules for Python's data analysis and machine learning libraries.
https://rasbt.github.io/mlxtend/
Other
4.82k stars 853 forks source link

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

Closed it176131 closed 3 months ago

it176131 commented 3 months ago

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

rasbt commented 3 months ago

Thanks for the note, and this sounds like a great improvement. Unfortunately, I have limited capacity to update and improve mlxtend due to other projects having higher priority and keeping me busy. However, if you'd like to work on a PR, I'd be more than happy to help merge it.

it176131 commented 3 months ago

Thanks for the note, and this sounds like a great improvement. Unfortunately, I have limited capacity to update and improve mlxtend due to other projects having higher priority and keeping me busy. However, if you'd like to work on a PR, I'd be more than happy to help merge it.

I'd be happy to submit a PR! I'll link to this issue and tag you.