KatInterview

Rapid-Fire ML Fundamentals Check for a Product Recommender

Machine LearningModel answer
HardModel answerMachine Learningmachine-learningfundamentalsregularization

Last updated

Answer a set of short core machine-learning questions covering models, regularization, evaluation, optimization and ranking, framed around building a product recommendation system.

Context

You are being screened for a role on a team that builds a recommendation system for an online store. The interviewer wants to check how broad and accurate your machine-learning fundamentals are. Each topic below should get a short, precise answer: a definition, the reason it works, and one practical action you would take. Link answers to recommendations where it fits naturally.

Questions

  1. How do a single decision tree and a random forest differ?
  2. Compare L1 and L2 regularization. How does each deal with overfitting, and what about underfitting?
  3. You have one million labeled examples. Would you pick a deep neural network or KNN, and why?
  4. Is the ROC curve only meaningful for binary classification? Given a list of model scores and true labels, how would you draw one?
  5. What makes training loss oscillate, and how would you stabilize it?
  6. Define data drift and explain how you would detect it in production.
  7. How do convex and non-convex objectives differ?
  8. In which parts of a neural network do vanishing gradients typically appear, and how do you reduce them?
  9. As a decision tree gets deeper, how does inference time scale: linear, logarithmic, or exponential?
  10. Which is more reliable for estimating performance: cross-validation or a single train/test split?
  11. Summarize the main ideas behind convolutional neural networks.
  12. Contrast transformer encoders with transformer decoders.
  13. Describe the k-means algorithm and the assumptions it makes.
  14. What values can cosine similarity take?
  15. Is logistic regression generative or discriminative?
  16. How do you read a confusion matrix, and when would you reach for ensemble methods?
  17. Compare Naive Bayes and KNN.
  18. Name regularization techniques other than L1 and L2.
  19. Gradient boosting machines vs random forests: where is each stronger or weaker?
  20. What does it mean for a model to be calibrated, and how do you measure it?
  21. Describe the learning-to-rank problem.

Expectations

Cover definitions, intuition for the math, computational cost, evaluation metrics, and realistic failure modes. Include formulas or short pseudocode where they help.

Hints

Hint 1

For each item, aim for three parts: the definition, the mechanism (why it behaves that way), and a concrete action you would take in practice. Keep each answer to a few sentences.

Hint 2

Several questions hinge on a single distinction: variance vs bias (bagging vs boosting, L2 shrinkage), training cost vs inference cost (KNN vs DNN, tree depth), and discriminative vs generative modeling (logistic regression vs Naive Bayes).

Hint 3

For the ROC question, sort by score, sweep the threshold while handling ties together, and record (FPR, TPR) at each step. For recommendations, remember to split by time or by user to avoid leakage when validating.