Label Encoding assigns an integer value to each unique category in a feature. For example, if you have three towns: ['West Windsor', 'Robbinsville', 'Princeton']
, Label Encoding would convert them into numerical values like this:
- West Windsor → 0
- Robbinsville → 1
- Princeton → 2
Interpretation in the Model: When you use Label Encoding, the model interprets the numbers as continuous values, meaning it sees a numeric relationship between them (i.e., “Princeton” might be considered numerically higher than “West Windsor” and closer to “Robbinsville”). This can cause issues if the numeric values don’t have any ordinal relationship.