Model Selection, Tuning, and Generalization Questions
Choosing and tuning models so they generalize to unseen data rather than memorizing the training set. Covers the bias-variance tradeoff and its decomposition, diagnosing over- and under-fitting from learning curves, and regularization techniques such as L1/L2 penalties, dropout, and early stopping, alongside cross-validation strategies and grid, random, and Bayesian hyperparameter search. Emphasizes a principled, reproducible process for selecting model complexity and tuning against a real compute-versus-accuracy budget rather than ad-hoc trial and error.
Describe how you would implement k-fold-cross-validated grid search from scratch in Python, without using scikit-learn's GridSearchCV: what does your code need to loop over, and where exactly does the cross-validation fit relative to the grid loop?
You have two candidate models, a logistic regression and a deep neural network, with similar validation scores. Walk through the factors beyond the raw metric that would actually decide which one you ship.
Explain multi-fidelity hyperparameter optimization: how Hyperband/ASHA (Successive Halving with brackets) and BOHB (Bayesian optimization plus Hyperband) allocate resources across rungs, and the trade-off between speed and the risk of prematurely discarding a configuration that would have turned out promising.
Using RandomizedSearchCV, show how you'd tune the hyperparameters of a real scikit-learn Pipeline that includes a TfidfVectorizer (for text features) feeding into a classifier, tuning both the vectorizer's parameters and the classifier's hyperparameters jointly.
When would you prefer an ensemble of models over a single model in production, and when would the latency and memory cost not be worth it? For a service with a strict p99 latency budget, how would you decide, and what quantitative check would you run before committing to an ensemble that improves offline accuracy?
Unlock Full Question Bank
Get access to all Model Selection, Tuning, and Generalization interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.