Why is LabelEncoder unsuitable for encoding a categorical feature column before fitting a linear model?
Correct answer
A. It imposes an arbitrary ordinal order, which the model then treats as numeric distance
17 views
A. It imposes an arbitrary ordinal order, which the model then treats as numeric distance
17 views
LabelEncoder maps categories to integers 0 to n-1, which a linear model reads as a magnitude, so one city could dominate another purely because of the assigned code. OneHotEncoder or pd.get_dummies creates indicator columns that carry no false ordering. LabelEncoder remains appropriate for the target of a classification problem, where labels are categories with no distance.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is A? Ask here and get an explanation.