Closed Pacman1984 closed 1 year ago
Hi @Pacman1984
I understand that this technique can improve model quality and that you want to contribute it to a bigger framework. Both of these points make absolute sense.
I'm not quite sure though if category_encoding is the correct library for this since the method does not encode a categorical feature to a numeric one. It would be better placed in a dedicated feature engineering library or am I getting this wrong? Unfortunately sklearn-contrib does not have a feature engineering library.
Let's keep this issue open for the time being and let's get more input/opinions of the community.
A similar discussion has taken place already in #227 and was considered off topic and too broad which I also agree with. So I'm closing this issue
Expected Behavior
Also posted in scikit-lego issue, but maybe its better implemented here.
Concatenating categorical variables is a powerful feature engineering technique, often used in competitions. You could watch the 9 minuts of this Video for understanding the topic: Winning Solution --> RecSys 2020 Tutorial: Feature Engineering for Recommender Systems,
Categorical Variable Concatenation is not implemented in scikit-learn or scikit-learn-contrib packages.
I have coded this feature in a separate repo catcomb and would implement this solution in category_encoders, if you agree.
Basically, what it does, it concatenates all categorical columns with each other based on some parameters you can chose.
Its a ColumnsTransformer where you can choose
columns: if the categorical columns should be infered automatically, or the column names should be given
level: the level of 'combinatorial' deepness![image](https://user-images.githubusercontent.com/14351072/160840018-7209d142-0bd0-4572-9a48-d9f191de5acb.png)
max_cardinality: the maximal cardinality of the original columns which should be included in the concatenation process, because very high cardinality concatination isn't that useful
Example
pipe = Pipeline([("catcomb", ColumnsConcatenation(columns='auto', level=2, max_cardinality=500))])