MS-DS Master of Data science Feature Engineering 1 — Questions and Answers
Question 1: Which technique is used to reduce the impact of outliers when scaling numerical features?
- Min-Max Normalization
- Robust Scaling (Correct answer)
- Log Transformation
- One-Hot Encoding
Correct answer: Robust Scaling
Robust Scaling uses the median and interquartile range (IQR) instead of mean and standard deviation, making it resistant to the influence of outliers.
Question 2: What is the primary purpose of one-hot encoding in feature engineering?
- Reduce dimensionality of numerical features
- Convert ordinal categories into ranks
- Convert nominal categorical variables into binary indicator columns (Correct answer)
- Normalize skewed distributions
Correct answer: Convert nominal categorical variables into binary indicator columns
One-hot encoding converts nominal categorical variables into binary (0/1) indicator columns so that machine learning algorithms can process them without implying an ordinal relationship.
Question 3: Label encoding is most appropriate for which type of categorical variable?
- Nominal variables with many unique values
- Binary variables only
- Ordinal variables with a meaningful rank order (Correct answer)
- Continuous variables with missing values
Correct answer: Ordinal variables with a meaningful rank order
Label encoding assigns integer values that preserve rank order, making it appropriate for ordinal variables where the numerical order is meaningful (e.g., low=1, medium=2, high=3).
Question 4: Which feature transformation is most commonly applied to correct a right-skewed (positively skewed) distribution?
- Squaring the feature
- Applying a log transformation (Correct answer)
- Applying min-max scaling
- Applying principal component analysis
Correct answer: Applying a log transformation
A log transformation compresses large values more than small values, which reduces right skew and helps bring the distribution closer to normal.
Question 5: What does 'feature interaction' refer to in the context of feature engineering?
- Removing correlated features from a dataset
- Creating new features by combining two or more existing features (Correct answer)
- Imputing missing values using surrounding feature values
- Reducing the number of features via dimensionality reduction
Correct answer: Creating new features by combining two or more existing features
Feature interaction involves creating new features by combining existing ones (e.g., multiplication or ratio), which can capture relationships that individual features cannot represent.
Question 6: Which imputation strategy is most appropriate when data is missing completely at random (MCAR) and the dataset is small?
- Dropping all rows with missing values
- Replacing with the most frequent value
- Multiple imputation using chained equations (MICE) (Correct answer)
- Replacing with a constant value of 0
Correct answer: Multiple imputation using chained equations (MICE)
MICE (Multiple Imputation by Chained Equations) is preferred for small datasets with MCAR missingness because it preserves variability and uses information from other features to impute realistically.
Question 7: What is target encoding and what is its main risk?
- Encoding the target variable as a float; risk is data type mismatch
- Replacing a category with the mean of the target variable for that category; risk is data leakage (Correct answer)
- Encoding all features relative to the target range; risk is overfitting the target
- Normalizing the target variable; risk is losing interpretability
Correct answer: Replacing a category with the mean of the target variable for that category; risk is data leakage
Target encoding replaces each category with the mean target value for that category, which is powerful but risks leaking target information into features if not properly cross-validated.
Which technique is used to reduce the impact of outliers when scaling numerical features?