問題文
A categorical column holds the payment method with four possible values that have no natural order. The model is a linear model. Which encoding is appropriate, and what would go wrong with the alternative?
選択肢
- One-hot encoding, because assigning integers to unordered categories lets the model read an order and a distance that do not exist.
- Either encoding, used for the payment method column in this model, because with only four categories the difference between them is too small to affect the fitted coefficients.
- Label encoding, because it keeps the number of columns small for the payment method and a linear model is not sensitive to the particular integers that were assigned to the categories.
- Leave the column as text, with the four payment method values in place, because the model can read the category names directly and will learn a coefficient for each name.