For a nominal categorical variable that has two levels, e.g. Gender (levels = Male,Female), is it feasible to use label encoding instead of One Hot encoding ? If it is, are there any implications of using one encoding method over the other, for such a categorical variable ?
If you use one-hot here, you're just adding an unnecessary variable that is perfectly correlated with another variable in your model. Rather than thinking of it as a label encoding of gender where "0=male, 1=female", think of it as a binary flag for is_female, where "0=false, 1=true".
$\begingroup$ The confusion lies with Label Encoding, where an ordering is assumed between levels. Wouldn't this phenomenon be attributed with the gender variable ? $\endgroup$– GaleFeb 23, 2018 at 13:54
1$\begingroup$ If there're only two levels, the ordering doesn't matter. Reordering the levels would just change the variable from
is_male. You'd interpret the coefficient slightly differently and the intercept/bias would change as well to accommodate it, but that's really it. Try it out on some toy data and see what happens. $\endgroup$ Feb 23, 2018 at 22:37