Feature Engineering Flashcards
7 cards from real MS-DS Master of Data science practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Feature Engineering flashcards as text
Which of the following is a valid technique to handle high-cardinality categorical features?
Answer: Target encoding with cross-validation
Target encoding with cross-validation handles high cardinality by summarizing each category with the mean target value while preventing data leakage through cross-validation folds.
In time series feature engineering, what is a 'lag feature'?
Answer: A feature whose value is the observation from a prior time step
A lag feature captures the value of a variable at a previous time step, allowing models to learn temporal dependencies such as how past values influence current outcomes.
What is the 'curse of dimensionality' and how does it motivate feature selection?
Answer: Data becomes increasingly sparse as dimensions grow, degrading model performance; motivates removing irrelevant features
As the number of features grows, the data becomes exponentially sparser in the feature space, making distance metrics unreliable and models prone to overfitting, which motivates removing irrelevant or redundant features.
Which method uses a model's built-in feature importance scores to select features?
Answer: Embedded method
Embedded methods perform feature selection as part of the model training process itself (e.g., LASSO regression or tree-based feature importances), integrating selection and learning simultaneously.
What transformation is typically applied to convert a cyclical feature such as 'hour of day' into usable numerical features?
Answer: Applying sine and cosine transformations based on the cycle length
Sine and cosine transformations map cyclical features onto a circle, ensuring that the model perceives hour 23 and hour 0 as close to each other rather than far apart.
When using Recursive Feature Elimination (RFE), how does the algorithm select features?
Answer: It trains a model on all features and removes the least important feature iteratively until the desired number remains
RFE trains a model, removes the feature with the lowest importance score, retrains, and repeats this process iteratively until the specified number of features remains.
What is the main advantage of using Polynomial Features in scikit-learn for feature engineering?
Answer: It generates interaction terms and higher-degree features to capture non-linear relationships
Polynomial Features creates all combinations of feature interactions and powers up to a specified degree, enabling linear models to capture non-linear patterns in the data.