Data Science Feature Engineering and Selection 2 — Questions and Answers
Question 1: You apply a log transformation to a right-skewed feature containing zero values. What problem will this cause?
- log(0) is undefined/negative infinity (Correct answer)
- It removes all outliers automatically
- It converts the feature to categorical
- It guarantees a normal distribution
Correct answer: log(0) is undefined/negative infinity
log(0) is undefined, so a constant (e.g., log1p) must be added before transforming zeros.
Question 2: Which technique creates new features by multiplying or combining two existing features?
- Interaction features (Correct answer)
- Standardization
- Imputation
- Label encoding
Correct answer: Interaction features
Interaction features capture combined effects by multiplying or otherwise combining existing variables.
Question 3: When applying one-hot encoding to a feature with very high cardinality, the main drawback is:
- A large, sparse feature space that increases dimensionality (Correct answer)
- Loss of all category information
- Automatic target leakage
- Conversion of numbers to text
Correct answer: A large, sparse feature space that increases dimensionality
High-cardinality one-hot encoding produces many sparse columns, dramatically increasing dimensionality.
Question 4: Target encoding replaces a category with what value?
- The mean of the target for that category (Correct answer)
- A random integer
- The category frequency rank
- The standard deviation of the feature
Correct answer: The mean of the target for that category
Target (mean) encoding maps each category to the average target value observed for it.
Question 5: Which scaling method is most robust to outliers?
- Robust scaling using median and IQR (Correct answer)
- Min-max scaling
- Standardization (z-score)
- Unit vector normalization
Correct answer: Robust scaling using median and IQR
RobustScaler uses the median and interquartile range, making it resistant to outliers.
Question 6: Binning a continuous variable into discrete intervals is primarily used to:
- Reduce the effect of minor observation errors and capture non-linearity (Correct answer)
- Increase the number of decimal places
- Guarantee linear relationships
- Remove the need for scaling entirely
Correct answer: Reduce the effect of minor observation errors and capture non-linearity
Binning reduces noise from small measurement variations and can model non-linear effects.
Question 7: A polynomial feature of degree 2 on feature x adds which term?
- x squared (Correct answer)
- log(x)
- 1/x
- the square root of x
Correct answer: x squared
Degree-2 polynomial expansion adds x² (and cross terms for multiple features).
You apply a log transformation to a right-skewed feature containing zero values.
What problem will this cause?