QuestionQ95

VerifiedModel Development

A data scientist is working on a machine-learning project using a dataset with these features:

  • CustomerID: A unique identifier for each customer.
  • Age: The customer's age.
  • Gender: The customer's gender (Male, Female).
  • ZipCode: The United States ZIP Code in which the customer resides.
  • PurchaseAmount: The total amount spent by the customer.

They are building a linear regression model to predict PurchaseAmount. Given the dataset features, to which column, and why, should the machine-learning engineer apply one-hot encoding to prepare the dataset for training a machine-learning model?

Explanation

One-hot encoding is appropriate for Gender because it is a nominal categorical feature with a small number of categories and no ordinal relationship. This lets a linear regression model use the category without incorrectly treating one gender label as numerically greater than the other.

Community Discussion

No comments yet. Be the first to start the discussion!