Encode Rare Labels with Feature-engine

Encode Rare Labels with Feature-engine

When dealing with features with high cardinality, you might want to mark the rare categories as “Other”. Feature-engine’s RareLabelEncoder makes it easy for you to do so.

In the code above, we use RareLabelEncoder to replace categories with the frequency below 0.05 in the column “education” with “Other”.

Link to Feature-engine.

My previous tips on feature engineering.

Search

Related Posts

Related Posts

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran