FreeExam

ML fundamentals

An AI/ML engineer interview on bias and variance, regularization, cross-validation, and the metrics you pick before you trust a model.

These prompts are original practice. They are not questions from a named employer or a live hiring loop.

  1. 1.A gradient-boosted model scores 0.99 accuracy on its training rows and 0.81 on a held-out week. A smaller model scores 0.84 on both. What does the gap in the first model mostly show?

  2. 2.A linear model for house prices has a training RMSE of 92,000 dollars and a validation RMSE of 94,000. The business needs under 40,000. Where is the problem?

  3. 3.Which change usually lowers variance and raises bias?

  4. 4.As you add training rows, training error rises slowly and validation error falls. The gap between them keeps shrinking but has not closed. What is the next step most likely to help?

  5. 5.Training and validation curves both flattened at the same high error after 20,000 rows. Will going to 200,000 rows help much?

  6. 6.For squared error, the expected error on a new point splits into which three parts?

  7. 7.Where does the irreducible error in that split come from?

  8. 8.In k-nearest neighbors, what happens when you move k from 1 to 50?

  9. 9.A decision tree grown until every leaf is pure tends toward which failure?

  10. 10.Why does a random forest usually generalize better than one deep tree?

  11. 11.Boosting fits trees one after another, and each tree fits the errors the earlier ones left. Which error does that mainly attack?

  12. 12.A teammate says the model is overfit because validation accuracy is 3 points below training accuracy. What would you want to see before agreeing?

  13. 13.A very large network keeps improving on validation after it reaches zero training error. Does that break the bias and variance picture?

  14. 14.Which symptom points to underfitting?

  15. 15.Validation loss is lowest at epoch 14 and climbs after that while training loss keeps falling. What does early stopping do here?

  16. 16.Why must the early-stopping epoch be chosen on validation data and not on the test set?

  17. 17.What does L2 regularization add to the loss?

  18. 18.L1 regularization tends to produce something that L2 does not. What?

  19. 19.Why does L1 push small weights to exactly zero while L2 only shrinks them?

  20. 20.Two features are near copies of each other. How do lasso and ridge tend to treat them?

  21. 21.Elastic net mixes the L1 and L2 penalties. When is that worth it over plain lasso?

  22. 22.What happens to the coefficients when ridge regression's lambda goes from 0.01 to 100?

  23. 23.Why should features be standardized before an L2 penalty is applied?

  24. 24.Is the intercept term usually included in the L2 penalty?

  25. 25.What does dropout do during training?

  26. 26.With the common inverted-dropout implementation, what happens to dropout at inference?

  27. 27.A model's validation score changes every time you run evaluation on the same rows. You find dropout was still on. What went wrong?

  28. 28.With the Adam optimizer, why do people prefer decoupled weight decay (AdamW) over adding an L2 term to the loss?

  29. 29.Why is flipping and cropping training images a form of regularization?

  30. 30.For a model that reads handwritten digits, why is a horizontal flip a poor augmentation?

  31. 31.Label smoothing replaces a one-hot target of 1.0 with something like 0.9. What does it discourage?

  32. 32.Which of these is not a regularizer?

  33. 33.A model with 2 million parameters is trained from scratch on 5,000 labeled rows. Which plan is most reasonable first?

  34. 34.Dropout, a strong L2 penalty, and a max-norm limit were added together. Validation loss is now worse than with none of them. What is the likely reading?

  35. 35.What does 5-fold cross-validation give you that one 80/20 split does not?

  36. 36.When is k-fold cross-validation with random folds the wrong tool?

  37. 37.For time-ordered data, which validation scheme fits?

  38. 38.A dataset has 40 photos per patient across 300 patients. How should folds be made?

  39. 39.You tune hyperparameters with 5-fold cross-validation and report the best fold-averaged score as the expected production score. What is wrong with that?

  40. 40.What does stratified k-fold keep about the same in every fold?

  41. 41.The positive class is 2 percent of 3,000 rows. Why stratify the folds?

  42. 42.What is a drawback of leave-one-out cross-validation?

  43. 43.A scaler is fit on the full dataset before the cross-validation folds are made. What does that do?

  44. 44.What is the clean way to avoid that leak?

  45. 45.Feature selection keeps the 50 features most correlated with the label, using all 1,000 rows. Cross-validation then runs on those 50. Why is the score inflated?

  46. 46.What is the test set for?

  47. 47.A fraud model on data with 0.5 percent fraud reports 99.5 percent accuracy. What trivial model matches it?

  48. 48.On 1,000 cases, a model gets 80 true positives, 20 false positives, 40 false negatives, and 860 true negatives. What is precision?

  49. 49.With 80 true positives, 20 false positives, 40 false negatives, and 860 true negatives, what is recall?

  50. 50.With precision 0.80 and recall about 0.67, what is F1?

  51. 51.With 20 false positives and 860 true negatives, what is the false positive rate?

  52. 52.When does recall matter more than precision?

  53. 53.A spam filter that moves real mail into spam annoys users far more than missed spam does. Which metric should the team watch most closely at the chosen threshold?

  54. 54.A false positive costs 1 dollar and a false negative costs 500 dollars. Why is F1 a poor single metric here?

  55. 55.What does ROC-AUC measure?

  56. 56.A model's ROC-AUC is 0.5. What does that mean?

  57. 57.With 1 positive per 1,000 rows, why can ROC-AUC look excellent while the model is useless at the top of its list?

  58. 58.What is the baseline average precision (PR-AUC) for a model that scores at random?

  59. 59.ROC-AUC stays the same when you raise the decision threshold from 0.5 to 0.8. Why?

  60. 60.Who should choose the operating threshold, and with what?

  61. 61.Model A says 0.99 for a case that turns out negative. Model B says 0.6 for it. How does log loss treat them?

  62. 62.What does it mean for a classifier to be well calibrated?

  63. 63.A model ranks well, with an AUC of 0.92, but only 60 percent of the cases it scores 0.9 are positive. What can fix that without retraining?

  64. 64.A model's score feeds an expected-cost calculation. Why does calibration matter here?

  65. 65.What is the Brier score?

  66. 66.Positives were upsampled to 50/50 for training, but real data is 5 percent positive. What happens to predicted probabilities on real data?

  67. 67.Three classes have F1 scores of 0.95, 0.90, and 0.40. The third class is 5 percent of rows. Which average exposes the weak class?

  68. 68.A 1,000-class image model reports top-5 accuracy. What counts as correct?

  69. 69.Errors on four predictions are 1, -1, 2, and -6. What is the mean absolute error?

  70. 70.For the same errors of 1, -1, 2, and -6, what is the root mean squared error?

  71. 71.Why is RMSE larger than MAE for those errors?

  72. 72.A regression model's R² on the validation set is 0. What does that mean?

  73. 73.Can R² on held-out data be negative?

  74. 74.Why is mean absolute percentage error a poor choice when some true values are near zero?

  75. 75.A delivery-time model is judged on how often drivers arrive late, not on average error. Which loss fits that better?

  76. 76.Minimizing mean absolute error makes a model predict which statistic of the target, given the features?

  77. 77.Positives are 1 percent of the data. Which is a good first move?

  78. 78.Class weights of 99 to 1 are used in training. What should you expect?

  79. 79.Why must oversampling methods like SMOTE be applied only inside the training fold?

  80. 80.Undersampling negatives from 1,000,000 to 50,000 throws data away. When is it still reasonable?

  81. 81.With heavy class imbalance, which kind of report is most honest?

  82. 82.Which models need feature scaling, and which mostly do not?

  83. 83.A city column has 40,000 distinct values. Why is plain one-hot encoding a problem for a linear model?

  84. 84.Target encoding replaces each category with the average label for that category. How can it leak?

  85. 85.How is target encoding usually made safe?

  86. 86.A feature called days_since_account_closed predicts churn almost perfectly. What do you check?

  87. 87.Missing values are filled with the column mean. Apart from a small leak if done before the split, what else is lost?

  88. 88.Why does k-nearest neighbors get worse with hundreds of raw features?

  89. 89.What does PCA keep when you reduce the data to 10 components?

  90. 90.Why can PCA throw away the signal a classifier needs?

  91. 91.Lowering the learning rate in gradient boosting from 0.3 to 0.03 usually requires what?

  92. 92.Which gradient boosting settings mostly control overfitting?

  93. 93.Random forest feature importance based on impurity reduction is known to favor what?

  94. 94.Why is permutation importance on validation data often preferred?

  95. 95.Two strongly correlated features each show low permutation importance. What could be going on?

  96. 96.Logistic regression is trained by minimizing which loss?

  97. 97.Why is logistic regression easier to optimize than a deep network?

  98. 98.Training loss jumps around and sometimes becomes NaN. What is the first setting to change?

  99. 99.Mini-batch SGD with batches of 32 is noisier than full-batch gradient descent. Why can that help?

  100. 100.One model was tuned for 200 trials and the other for 5. Why is comparing their best scores misleading?

  101. 101.Before training a neural network for a tabular churn problem, what should you already have?

  102. 102.What does the 'no free lunch' result mean in practice?

  103. 103.Averaging five models trained with different random seeds improves the validation score slightly. Where does the gain come from?

  104. 104.What does Naive Bayes assume?

  105. 105.Model B beats model A by 0.3 points of AUC on one validation split of 2,000 rows. What do you do before calling B better?

  106. 106.A model's validation AUC is 0.999 on a problem where experts reach about 0.75. What is the first suspicion?