Question 4 of 10Pro Only
Compare one-hot encoding, label encoding, and target encoding for categorical variables. When would you use each approach, and what are the potential pitfalls?
Sample answer preview
Encoding categorical variables is essential because most machine learning algorithms require numerical input. The choice of encoding method affects model performance and should match the nature of your data and algorithm. Label encoding assigns a unique integer to each category.
label encodingone-hot encodingtarget encodingcategorical variablesdummy variable traphigh cardinality