Microsoft Azure AI Fundamentals (AI-900)Describe fundamental principles of machine learning on AzureEasy
A data scientist is preparing a dataset for a machine learning model that predicts customer purchasing intent. One of the features is 'Customer_Segment', which can be 'New', 'Existing', or 'Premium'. The data scientist needs to convert this categorical feature into a numerical format suitable for most machine learning algorithms. Which of the following techniques should be used to represent this feature without implying any ordinal relationship?
- AFeature Scaling
- BBinning
- CLabel Encoding
- DOne-Hot Encoding
Show answer & explanationAnswer & explanation
Correct answer: D. One-Hot Encoding
One-Hot Encoding is the appropriate technique for converting nominal categorical data into a numerical format without introducing an artificial ordinal relationship. Each category is represented by a new binary column.
Why the other options are wrong
- A. Feature Scaling adjusts the range of numerical features and is not used for converting categorical data.
- B. Binning groups numerical data into bins and is not suitable for nominal categorical features like 'Customer_Segment'.
- C. Label Encoding assigns a unique integer to each category, which implies an ordinal relationship that does not exist in 'Customer_Segment'.
One-Hot Encoding
A technique used to convert categorical variables into a numerical format that machine learning algorithms can understand, by creating new binary features for each category.
- Creates a new binary column for each unique category.
- Prevents the model from assuming an ordinal relationship between categories.
- Commonly used for nominal (unordered) categorical data.
Memory trick: Transforming names into numbers, carefully.