MLA-C01 Question 56
Single answerYou are building a machine learning model to predict housing prices using a dataset that includes a feature for the number of rooms in each house. You notice that the distribution of the 'number of rooms' feature is highly skewed with a long tail. Which feature engineering technique is the most appropriate to address this issue?
- A
Apply one-hot encoding to the 'number of rooms' feature
- B
Use a log transformation on the 'number of rooms' feature
- C
Normalize the 'number of rooms' feature to a range between 0 and 1
- D
Discretize the 'number of rooms' feature into bins
Show answer and explanation
Correct answer: B
Explanation
Highly skewed numerical features can negatively impact machine learning model performance. A log transformation is a common feature engineering technique used to reduce skewness, especially when the data has a long tail. This makes the data more symmetric and improves model training. Other techniques like one-hot encoding, normalization, and binning are not designed to specifically handle skewness in numerical data.
- A. Incorrect.
One-hot encoding is used for categorical variables, not for numerical features like 'number of rooms'. This option is not suitable for addressing skewness in numerical data.
- B. Correct.
A log transformation is effective for reducing skewness in numerical data, especially when the feature has a long tail. This is the correct approach for this scenario.
- C. Incorrect.
Normalization rescales the values of a feature to a specific range (e.g., 0 to 1) but does not address issues related to skewness or long tails in the data distribution, making it an unsuitable choice here.
- D. Incorrect.
Discretizing the 'number of rooms' feature into bins could change the granularity of the data, but it does not directly address the skewness in the data distribution. This option is not ideal for this scenario.