Feature engineering interview questions
5 questions across 2 sections, in the order you would learn them. Every answer here is one that works — but an answer you have read is not an answer you can give, so use Test yourself and say it out loud first.
Shaping inputs so the model can use them
Read the section that teaches thisIf this comes up in an interview
When does feature scaling matter?
For linear models, neural networks and distance-based methods, where a feature on a larger numeric scale otherwise dominates. Tree models are invariant to monotonic transformations, so it makes no difference to them.
What is target encoding and why is it risky?
Replacing a category with the mean target value for that category. It is powerful and leaks the label directly unless computed within each training fold, in which case the offline score looks excellent and production performance collapses.
A feature makes your model far more accurate than expected. What do you check?
Whether it leaks. Is it populated only after the outcome is known, does it correlate with the label through how the data was ordered, is it an aggregate computed over the whole dataset. The test is whether it would genuinely be available with that value at prediction time.
Features for real tabular problems
Read the section that teaches thisIf this comes up in an interview
How would you build features for a churn prediction model?
Behaviour aggregates over several windows, such as usage, logins and support tickets in the last 7, 30 and 90 days, trends between windows, tenure, plan and billing features, all computed strictly before the prediction date. Then check importance and look hard at any feature that seems too good.
Then they push further
A feature called 'account_status' is by far the most important. Concerned?
Very. It may be updated when the customer churns, which means it encodes the answer. Check when it changes relative to the churn date. If it is set at or after churn, remove it.
How do you make sure features in production match training?
Compute them with the same code in both places, ideally from a feature store with point-in-time lookups, and monitor feature distributions in production against training.
What gets marked up. Marked up for point-in-time correctness and suspicion of features that are too good. Lists of features with no mention of leakage are marked down.
What is target encoding and what is its risk?
Replacing a category with the average outcome for that category. The risk is leakage: each row's own label influences its encoding. Compute it out of fold, and smooth rare categories towards the overall mean.
These are the questions for one topic. The whole question bank covers every topic on the site.