While doing the Microsoft Malware Classification challenge, I encountered a way of Feature representation called Count Based Features (CBF).
CBF is good to use with very high cardinality features, and it transforms the high number of categories in the data to the number of it’s occurrences. This representation is helpful because it extracts out a simple inherent feature of the data: count
Below shows a simple example of how we get the CBF of a given feature
CBF can be done in pandas in a single line
Train.groupby([' Feature1 '])[' Feature1 '].transform('count')
The output of this will give you
As you can see, the categorical values are all converted their count values!
Leave a Reply