InterviewStack.io LogoInterviewStack.io

Feature Engineering and Selection Questions

Covers the end to end process of transforming raw data into predictive and stable model inputs and choosing the most useful subset of those inputs. Topics include generating features from domain signals and timestamps, numerical transformations such as scaling binning and logarithmic transforms, categorical encodings including one hot and target encoding, creation of interaction and polynomial features, construction of dense feature vectors for model consumption, handling missing values and outliers, and strategies for class imbalance. Also includes feature selection and dimensionality reduction methods such as filter techniques statistical tests wrapper methods embedded model based selection mutual information analysis and tree based importance measures. Emphasis is placed on avoiding data leakage validating feature stability over time interpreting feature contributions and documenting rationale for feature creation or removal. For senior roles include designing feature engineering best practices mentoring others and considering feature impact on model interpretability and business metrics.

MediumTechnical
28 practiced
You're given two very high-cardinality categorical features A (1M unique) and B (500k unique). Describe pragmatic approaches to create interaction features between A and B without exploding cardinality or memory: include frequency thresholding, hashing, bucketization, learned pair embeddings, and sampling-based selection. Provide pseudocode for generating the top-K pairwise interactions ranked by lift or pointwise mutual information.
HardTechnical
20 practiced
You have baseline feature set A and candidate set B (A∪B is larger). Design an offline and online experimental plan to decide whether to deploy B: include offline cross-validation and holdout tests, uplift estimation, A/B rollout strategy with guardrail metrics, sample size calculation, monitoring windows, and rollback criteria if KPI degrades. Explain how to handle interaction effects and seasonality.
MediumTechnical
20 practiced
Given a pandas DataFrame events with schema: user_id (int), event_time (ISO8601 UTC string), event_type (string), value (float). Implement a Python function (using pandas) that produces per-user features as of a reference date: hour_of_day (cyclical sin/cos aggregated over last 7 days), day_of_week frequency, time_since_last_event (seconds), count_last_7_days, count_last_30_days. Ensure your function handles missing timestamps, timezones, and scales to tens of millions of rows (avoid Python-level loops).
MediumTechnical
34 practiced
You have 2000 sparse TF-IDF features. Compare TruncatedSVD, feature hashing, and a simple autoencoder as dimensionality reduction approaches before a downstream dense model. Discuss reconstruction/retained variance, interpretability, training and inference cost, ability to handle streaming data, and how each integrates into a retrain-deploy pipeline.
EasyTechnical
23 practiced
List and compare practical strategies to handle missing values for both numerical and categorical features in production ML: simple imputations (mean/median/mode), constant imputation with indicator flags, model-based imputation, forward/backward fill for time-series, treating missingness as a separate category, and approaches for MNAR. For each strategy describe pros/cons and suggested validation checks to ensure you aren't leaking label information.

Unlock Full Question Bank

Get access to hundreds of Feature Engineering and Selection interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.