juniorFeature Engineering
What is one-hot encoding in feature engineering?
Updated May 16, 2026
Short answer
One-hot encoding converts categorical variables into binary vectors.
Deep explanation
It transforms each category into a separate binary column. This prevents machine learning models from interpreting categorical values as ordinal.
Real-world example
Used in customer segmentation based on city or product category.
Common mistakes
- Creating too many columns leading to high dimensionality.
Follow-up questions
- What is dummy variable trap?
- When is label encoding better?