A rare category is a categorical value that occurs infrequently or has very few instances in a dataset. Such categories can make a model overfit during training, so they should be identified early, ideally during data extraction. section 2.2.5
Handle rare categories by:
- Aggregating similar rare categories into a larger class, using domain knowledge to decide which values belong together. section 2.2.5
- Distinguishing rarity from high cardinality: too many labels may call for target encoding or embeddings rather than simple aggregation. section 2.2.5
- Inspecting categorical distributions during exploratory analysis, alongside value counts and other checks for tabular-data problems. section 2.5
A practical encoding decision
Suppose a categorical feature contains several labels that appear only a few times. Combine genuinely similar labels into a broader category when domain knowledge supports that choice. If the feature instead contains many labels overall, consider target encoding for gradient boosting or embeddings for deep learning. section 2.2.5


