All 215 Supervised Learning interview questions
Classification, regression, evaluation and the classic bias-variance interview questions.
Every question below opens on its own page, with a full answer, the formulas written out and a multiple-choice check. Free to read, no account needed.
Fundamentals & theory
- What is the bias-variance tradeoff?easy
- How do you detect and fix overfitting?easy
- What is k-fold cross-validation and when do you use stratified or grouped folds?medium
- Generative vs discriminative classifier — what's the difference?medium
- What is the curse of dimensionality?medium
- Parametric vs non-parametric models — what's the difference?easy
- Why do we prefer simpler models when performance is equal?easy
- What does the no free lunch theorem say for ML?medium
- In one sentence, what is PAC learning?hard
- What is VC dimension and why should you care?hard
- What is Empirical Risk Minimization?medium
- Why do we care whether the loss landscape is convex?medium
- What are the roles of the training, validation and test sets?easy
- What does the IID assumption mean and when is it violated?medium
- Why is the base rate of the positive class critical to know?medium
- What is inductive bias and why does every model have one?medium
- What is the generalization gap and how do you shrink it?medium
- Why does OLS have a closed-form solution but logistic regression doesn't?medium
- What's the Bayesian interpretation of Ridge regression?hard
- What is a Generalized Linear Model and when is it the right tool?medium
- Why do we use cross-entropy (log loss) instead of MSE for classification?medium
- How is logistic regression fit in practice?medium
- Your scikit-learn logistic regression warns 'lbfgs failed to converge'. What do you do?medium
- How does Bayes' theorem drive Naive Bayes classification?easy
- The 'naive' independence assumption is almost always false. Why does Naive Bayes still work?medium
- Why do we compute Naive Bayes scores in log space?easy
- What are the core assumptions behind Linear Discriminant Analysis (LDA)?medium
- Why does KNN degrade badly in high dimensions?medium
- How do KD-trees and ball-trees speed up KNN, and when do they stop helping?medium
- Why not just fit a linear regression for a binary label (linear probability model)?medium
- What's the difference between probability, odds, and log-odds?easy
- Why is a single decision tree considered a 'high-variance' model?medium
- Why do decision trees (and boosted trees) fail to extrapolate?medium
- What is the out-of-bag (OOB) score in Random Forests?medium
- What is a support vector, and why does the SVM only depend on them?medium
- Why don't kernel SVMs scale well to millions of samples?medium
- What is 'deviance' and why is it used to evaluate GLMs?hard
- You must pick ONE metric for your model. How do you decide?medium
- An interviewer asks you to build a churn model. What do you do before touching any algorithm?easy
Linear & regularized regression
- L1 vs L2 regularization — what's the difference?easy
- Why is logistic regression called a linear model if it uses a sigmoid?medium
- What are the classical assumptions of linear regression?medium
- How do you interpret a coefficient in a multiple linear regression?easy
- What is VIF and when do you worry about multicollinearity?medium
- How do you handle strong multicollinearity in a linear model?medium
- How do you detect and fix heteroscedasticity?hard
- Adding a feature raised R^2. Does that mean the model improved?easy
- Can R^2 be negative? What does that mean?medium
- When would you use robust regression (Huber, RANSAC) instead of OLS?medium
- What's the main risk of polynomial regression?easy
- When should you add interaction features to a linear model?medium
- When does log-transforming the target help a regression model?medium
- What do Box-Cox and Yeo-Johnson transforms do?medium
- Why does Ridge regression give more stable coefficients than OLS?medium
- Why does L1 (Lasso) produce sparse coefficients but L2 (Ridge) does not?medium
- When is Elastic Net better than pure Lasso or Ridge?medium
- How do you choose the regularization strength (lambda / alpha)?medium
- Why must you standardize features before applying L1 or L2 regularization?easy
- In one sentence, what does the LARS algorithm compute?hard
- When would you use Group Lasso instead of standard Lasso?hard
- When is quantile regression more useful than mean (OLS) regression?hard
- What is 'perfect separation' in logistic regression and how do you fix it?hard
- L1 vs L2 in logistic regression — practical differences.easy
- What is Laplace (additive) smoothing in Naive Bayes?easy
- Pre-pruning vs post-pruning in decision trees — what's the difference and when do you use each?medium
- How does cost-complexity (CCP) pruning work?hard
- How does early stopping work in gradient boosting and why is it important?easy
- How does the C parameter in an SVM affect the fit?medium
- How does SVM adapt to regression (SVR)?medium
- What is Huber loss and why is it a compromise between MAE and MSE?medium
- What does the quantile (pinball) loss measure?hard
- What is stability selection?hard
- What are monotonic constraints in gradient boosting and when are they worth using?hard
- When would you use quantile regression instead of predicting the mean?medium
Logistic regression & classification basics
- Precision vs recall — when do you optimize each?easy
- How do you read a confusion matrix and derive the key metrics?easy
- One-vs-Rest, One-vs-One, and softmax — how do you choose for multi-class?medium
- Write out the softmax function and its main property.easy
- How do you interpret a logistic regression coefficient as an odds ratio?medium
- How do class weights work in logistic regression, and when do you use them?medium
- 'multinomial' vs 'ovr' setting in scikit-learn's LogisticRegression — what changes?medium
- Gaussian NB vs Multinomial NB vs Bernoulli NB — when do you use each?medium
- When would LDA outperform logistic regression?hard
- What is the nearest centroid (Rocchio) classifier and when is it useful?easy
- How does temperature scaling calibrate a classifier's probabilities?medium
- Why is accuracy a bad primary metric for many real-world problems?easy
- What is F-beta score and when is F1 not enough?medium
- Macro vs micro vs weighted averaging in multi-class metrics — how do you choose?medium
- What is Cohen's kappa and why is it useful?medium
- What is the Matthews Correlation Coefficient (MCC) and when should you use it?medium
- What is log loss (cross-entropy) and what does a specific value mean?medium
- What is the Brier score and how does it compare to log loss?medium
- What is top-k accuracy and when do you use it?easy
- What is balanced accuracy?easy
- What is the geometric mean (G-mean) in classification metrics?medium
- What is Youden's J statistic and how is it used?medium
- How do you interpret an ROC curve, and what point matters?medium
- What does ROC-AUC really measure, and what's a good value?easy
- What are the main pitfalls of relying on ROC-AUC?medium
- How do you select the decision threshold for a binary classifier?medium
- How do you evaluate a multi-label classifier?medium
- MAP, NDCG, MRR — when do you use each in ranking?hard
- How do you evaluate a classifier when FP and FN have different costs?hard
Naive Bayes, LDA & KNN
- Why is Naive Bayes still a solid baseline for text classification?easy
- QDA vs LDA — how do you choose between them?medium
- How is LDA used for supervised dimensionality reduction?medium
- How do you choose k in k-Nearest Neighbours?easy
- How do you choose the distance metric for KNN?medium
- What's the point of distance-weighted KNN?easy
- You trained Naive Bayes on balanced data but deploy on data where positives are 1%. What happens and what do you do?hard
- How does KNN imputation work and when is it a good choice?medium
Decision trees & random forests
- Random forest vs gradient boosting — which do you pick and why?medium
- Gini impurity, entropy, and classification error — which do trees actually use?medium
- How do decision trees handle categorical features?medium
- What are the most impactful hyperparameters of a decision tree?easy
- How do decision trees handle missing values?medium
- What criterion does a regression tree use to choose splits?easy
- How is feature importance computed from a decision tree or random forest?medium
- How does bagging reduce variance?medium
- Why does Random Forest sample features at each split, not just once per tree?medium
- How do Extra Trees differ from Random Forests?medium
- Which Random Forest hyperparameters actually matter for tuning?medium
- Are Random Forest probability estimates well-calibrated?medium
- What is Boruta and when do you reach for it?hard
Gradient boosting
- In one sentence, what is Gradient Boosting?medium
- What is the role of the learning rate (shrinkage) in GBM?easy
- What did XGBoost bring on top of vanilla GBM?hard
- What are LightGBM's key innovations vs XGBoost?hard
- What makes CatBoost different from XGBoost / LightGBM?hard
- Which XGBoost hyperparameters have the biggest impact, and in what tuning order?medium
- How do you handle class imbalance in XGBoost / LightGBM?medium
- How do XGBoost, LightGBM, and CatBoost each handle categorical features?medium
- How does gradient boosting handle missing values without imputation?medium
- What are monotonic constraints in XGBoost / LightGBM and when do you use them?hard
- Rule of thumb: when do you pick XGBoost vs LightGBM vs CatBoost?medium
- Is adding more features always safe with gradient boosting?medium
SVMs & kernels
Ensembling & stacking
Classification metrics
- When should you use PR-AUC instead of ROC-AUC?medium
- How do you check whether a classifier's probabilities are well-calibrated?medium
- Platt scaling vs isotonic regression for probability calibration — how do you choose?medium
- How do you choose the decision threshold for a classifier in a business setting?medium
- When do you need calibrated probabilities rather than a good ranking?medium
- Your positive class is 0.5%. Is resampling your first move?medium
Regression metrics
- RMSE vs MAE — how do you pick?easy
- What are the pitfalls of MAPE (Mean Absolute Percentage Error)?medium
- What is sMAPE and why is it used?medium
- What is explained variance score and how does it differ from R^2?hard
- When would you use MSLE (mean squared log error) instead of MSE?hard
- Is R^2 a useful metric for non-linear models (RF, GBM, neural nets)?medium
Cross-validation & data splitting
- Leave-One-Out CV — when is it a good idea, and when is it a bad idea?medium
- What is nested cross-validation and when do you need it?hard
- Why would you use repeated k-fold instead of standard k-fold?medium
- How do you set up cross-validation for time series?hard
- How do you pick the train/validation/test split sizes?easy
- How does cross-validation change for heavily imbalanced classification?medium
- You use stratified k-fold on a dataset with duplicate customer records — why is it wrong?medium
- When would you use the bootstrap for model evaluation instead of k-fold?hard
- When is cross-validation NOT necessary?easy
- When does a random train/test split give you a misleading score?medium
Feature engineering & encoding
- Which models need feature scaling and which don't?easy
- What is target leakage and how do you prevent it?medium
- Ordinal vs nominal encoding — how do you choose?easy
- What is target encoding and when is it useful?medium
- How do you prevent leakage in target encoding?hard
- What is frequency (count) encoding?easy
- What is feature hashing (the 'hashing trick') and when is it useful?medium
- What is Weight of Evidence (WoE) encoding?hard
- How do you encode cyclical features like hour-of-day or day-of-week?medium
- How do you turn text into features for a classical model?easy
- You have a feature with 50,000 unique category values. How do you encode it?medium
- When should you manually engineer interaction features?medium
- When is discretization (binning) a useful feature transformation?medium
- StandardScaler vs MinMaxScaler vs RobustScaler — how do you choose?easy
- Filter, wrapper, and embedded feature selection — how do they differ?medium
- How exactly does SMOTE generate synthetic minority-class samples?medium
- What does ColumnTransformer do and when do you need it?easy
- You did StandardScaler().fit_transform(X) then split into train/test. Why is this wrong?easy
- Why is target encoding dangerous, and how do you do it safely?hard
Feature selection
- How does Recursive Feature Elimination (RFE) work?medium
- How does permutation importance work and when is it better than impurity-based importance?medium
- Can you use SHAP values for feature selection?medium
- When can aggressive feature selection actually hurt performance?medium
- What does VarianceThreshold do and when is it useful?easy
- Mutual information vs chi-square vs ANOVA F for feature selection — how do you pick?medium
Imbalanced data
- How do you handle class imbalance in a dataset?medium
- SMOTE, Borderline-SMOTE, SVM-SMOTE, ADASYN — when do you use each?hard
- Random undersampling vs Tomek links vs cluster-centroid undersampling — what's each for?medium
- What is focal loss and why does it help with class imbalance?hard
- Class weights vs resampling for imbalance — which do you reach for first?easy
Missing data & outliers
Hyperparameter tuning
- Grid search vs random search for hyperparameter tuning — which do you use?easy
- How does Bayesian hyperparameter optimization work at a high level?hard
- What is Optuna's TPE sampler and why is it popular?hard
- How do Successive Halving / Hyperband / ASHA speed up hyperparameter search?hard
- How do you tune when you have multiple objectives (accuracy AND latency AND size)?hard
Pipelines & leakage
- Why should preprocessing live inside a scikit-learn Pipeline rather than being applied manually before?easy
- Your new model has 60% AUC and the baseline had 75%. How do you debug?medium
- You detect concept drift in production. What do you do?medium
- How do you train and evaluate a model when labels arrive weeks after predictions?hard
- Your model has great offline metrics. What do you check before serving it in production?medium
- Your model scores AUC 0.92 offline but barely helps in production. What are the usual causes?hard
- How do you handle noisy labels in a supervised dataset?hard
- How do you decide how often to retrain a supervised model?medium