Machine Learning Fundamentals — Interview Q&A
Q1. What's the difference between supervised and unsupervised learning?
Supervised learning trains on examples that already have a correct answer attached; unsupervised learning finds structure with no labeled answer at all. Example: predicting loan default (label: defaulted or not) is supervised; grouping customers by purchase behaviour with no pre-existing segment labels is unsupervised (k-means). Common mistake: assuming every ML technique needs labels. Fix: check whether your training data actually has a known correct answer per example. Say this in the interview: "Supervised learning has an answer key to learn from. Unsupervised learning finds structure without one."
Q2. Why do you always need a train/test split?
Because evaluating a model on the same data it trained on tells you how well it memorised, not how well it generalises. Example: a model scoring 99% on training data and 61% on held-out test data has clearly memorised rather than learned a real pattern. Common mistake: reporting training-set performance as "the model's accuracy." Fix: always report performance on data the model never saw during training. Say this in the interview: "Training accuracy tells me almost nothing on its own — I always report test-set performance, since that's the data the model never saw."
Q3. Why build a baseline model before a real one?
Because a model's score only means something relative to the simplest reasonable alternative. Example: a model with 92% accuracy sounds good until you learn a trivial "always guess the majority class" baseline already scores 90% — the real model only added 2 points of value. Common mistake: reporting a model's raw score as impressive without checking the baseline. Fix: always compute and report the baseline first. Say this in the interview: "I always start with the dumbest reasonable baseline — it tells me what 'good' actually means for this specific problem."
Q4. Explain overfitting vs. underfitting, and how you'd spot each.
Overfitting is memorising the training data instead of learning the pattern; underfitting is not learning enough of the pattern at all. Example: a big gap between training score (very high) and test score (much lower) is the classic overfitting signature; both scores being low together is underfitting. Common mistake: only watching the training score go up. Fix: always track train and test scores side by side, and treat a growing gap as a red flag, not a win. Say this in the interview: "I watch the gap between train and test performance, not just the training score — a growing gap means the model's memorising, not learning."
Q5. Why is accuracy a misleading metric on imbalanced data?
Because a model that always predicts the majority class can score very high accuracy while being completely useless on the minority class. Example: with only 1% of transactions being fraud, always predicting "not fraud" gives 99% accuracy while catching zero fraud. Common mistake: reporting accuracy as the headline metric for a rare-outcome problem. Fix: use precision, recall, and F1 instead, which specifically expose how the model handles the rare class. Say this in the interview: "On imbalanced data, I don't trust accuracy alone — I always check precision and recall for the class that actually matters."
Q6. Walk through precision and recall with a concrete example.
Precision asks "of everyone I flagged, how many really were positive"; recall asks "of everyone who really was positive, how many did I catch." Example: a churn model with TP=4, FP=2, FN=1 (out of 5 real churners) gives precision = 4/6 ≈ 0.67 and recall = 4/5 = 0.80. Common mistake: optimising only for one of the two without considering which mistake actually costs more. Fix: decide first whether a false positive or a false negative is costlier for this specific business problem, and prioritise accordingly. Say this in the interview: "Precision and recall trade off against each other — the right balance depends entirely on which mistake costs more in this specific case."
Q7. What is data leakage, and how would you catch it?
Leakage is when a feature contains information that wouldn't actually be available at the real prediction moment, making the model look great in testing and fail in production. Example: a churn model using "number of support tickets filed in the cancellation month" as a feature — that count is really a symptom of already having decided to leave, not a predictor available before the decision. Common mistake: trusting a feature just because it's highly predictive in testing. Fix: for every feature, explicitly ask "would I actually know this before the moment I need to predict?" Say this in the interview: "If a feature looks suspiciously predictive, the first thing I check is whether it secretly contains information from after the prediction point."
Q8. What's the difference between MAE and RMSE, and when would the gap between them matter?
Both measure typical prediction error for a regression model; RMSE squares errors first, so it punishes large individual errors more than MAE does. Example: 5 house-price predictions with errors of 2, −3, 5, −2, −5 (₹ lakh) give MAE = 3.4 and RMSE = 3.66 — RMSE is higher because one error (5 lakh) is noticeably bigger than the rest. Common mistake: reporting only one of the two. Fix: report both — a bigger gap between MAE and RMSE than expected is itself a signal that a few predictions are badly off, not evenly distributed error. Say this in the interview: "A larger-than-expected gap between MAE and RMSE tells me a few predictions are especially bad, not that error is spread evenly."
Q9. Why would you use cross-validation instead of a single train/test split?
Because a single split's result can be lucky or unlucky, especially on a small dataset — cross-validation averages across several different splits for a more reliable estimate. Example: 5-fold cross-validation trains and tests 5 times on 5 different slices, then averages, rather than trusting one specific split. Common mistake: trusting a single split's score on a small dataset without checking how much it varies across different splits. Fix: use cross-validation, especially when the dataset is small enough that one split's luck could meaningfully shift the result. Say this in the interview: "On a small dataset, I use cross-validation rather than trusting one split — it's much harder to get lucky or unlucky across several splits at once."
Q10. How would you choose a decision threshold for a classifier, rather than just using the default 0.5?
By weighing the actual cost of a false positive against the cost of a false negative for this specific problem, and adjusting the threshold accordingly. Example: a spam filter set to flag at a lower probability threshold catches more spam (higher recall) but wrongly flags more real email (lower precision) — the right threshold depends on which mistake is more costly for the actual users. Common mistake: treating 0.5 as a universal default with no further thought. Fix: pick the threshold deliberately based on the real-world cost of each mistake type. Say this in the interview: "0.5 is just a default — I choose the actual threshold based on which kind of mistake is more expensive for this specific use case."
Q11. What's model monitoring, and why does a model that worked fine at launch need it?
The real world a model operates in can shift over time, quietly degrading a model's performance even though nothing was technically "broken." Example: a churn model trained on last year's customer behaviour may quietly underperform as customer habits genuinely change, with no code change causing it. Common mistake: assuming a model's launch-day performance is a permanent fact. Fix: track prediction distributions and, where possible, real-world outcomes over time, and treat a sudden shift as a signal to investigate or retrain. Say this in the interview: "A model's accuracy at launch isn't permanent — the world underneath it changes, so I monitor it rather than assuming it stays good."
Q12. How does evaluating a classic ML model relate to evaluating an LLM-based system?
The specific metrics differ, but the underlying discipline — never trust an untested number, always compare to a baseline, watch for leakage — carries over directly. Example: an LLM eval set that accidentally overlaps with data the model was trained or fine-tuned on is the same leakage failure mode as a classic ML feature leaking future information. Common mistake: treating LLM evaluation as an entirely separate discipline with no relationship to classic ML evaluation habits. Fix: apply the same "held-out test set, baseline comparison, watch for leakage" discipline to LLM evals, even though the specific metrics (golden sets, LLM-as-judge) differ from a confusion matrix. Say this in the interview: "The tools are different — small trained models versus huge pre-trained ones — but 'never trust an untested number' is the same rule in both worlds."

