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
27 practiced
Given an events table in PostgreSQL:
| event_id | user_id | event_type | amount | occurred_at |
Write a SQL query (Postgres) that computes per-user features for the last 30/7/90 day windows: total_events_30d, avg_amount_7d, days_since_last_event, and count_distinct_event_types_90d as of a given reference timestamp :ref_ts. Explain indexes and performance considerations to run this as a daily batch job for millions of users.
MediumTechnical
22 practiced
Explain how tree-based models compute feature importance: gain (split improvement), split count, and permutation importance. Describe common pitfalls (bias toward high-cardinality features, correlated features splitting importance) and, as an MLE, propose methods to obtain more reliable importance estimates (e.g., permutation importance, SHAP, conditional importance).
MediumTechnical
23 practiced
Evaluate the pros and cons of using automated feature engineering tools (e.g., FeatureTools, tsfresh, autofeat) versus manual, domain-driven feature creation. As an MLE, when would you adopt AutoFE, how would you validate the generated features, and what guardrails would you put around automatic feature expansion to avoid feature explosion and instability?
MediumTechnical
43 practiced
Given numeric features and a continuous target, design a pipeline (pseudocode or Python) that computes mutual information between each feature and the target, ranks features by MI, and selects top-k. Explain discretization choices for continuous variables, which scikit-learn estimator you would use (e.g., mutual_info_regression), and how to guard against spurious correlations.
MediumSystem Design
28 practiced
Design a monitoring system to detect feature drift and instability for deployed features. Define which metrics you would compute (PSI, KL divergence, KS, mean/std changes), sampling strategies, alert thresholds, and automated mitigation actions (retrain, freeze, or rollback). Explain how you'd evaluate false positives and incorporate seasonality.

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.