Data & ML
Machine Learning interview questions on supervised/unsupervised learning, model evaluation, regularisation, and algorithm trade-offs.
Commonly asked at: Commonly asked at data-heavy product companies such as Flipkart, Swiggy, and Amazon (for ML/data roles) — general pattern, not company-verified.
Company names below are mentioned only to indicate the general type/level of interview these questions are common at, based on widely known industry patterns. This content is not affiliated with, endorsed by, or sourced from any confidential material of the named companies. All trademarks belong to their respective owners.
Supervised vs unsupervised learning — what's the difference?
Tip: Give one example of each — house price prediction vs customer segmentation — it's the standard way to answer this.
Supervised learning trains on labeled data, where each input has a known correct output — like predicting house prices from past sales with known prices. Unsupervised learning works with unlabeled data and finds patterns on its own, like clustering customers into segments without predefined categories.
What is overfitting, and how do you prevent it?
Tip: List at least 2-3 prevention techniques — a one-line answer feels incomplete here.
Overfitting is when a model learns the training data too closely, including its noise, and performs poorly on new data. I'd prevent it with more training data, simplifying the model, adding regularization, using dropout in neural nets, and validating with cross-validation.
What is the bias-variance tradeoff?
Tip: Define bias and variance separately first, then state the tradeoff — don't jump straight to "tradeoff."
Bias is error from a model being too simple to capture the pattern — underfitting. Variance is error from being too sensitive to the training data's fluctuations — overfitting. Reducing one tends to increase the other, so the goal is finding the right balance for lowest total error on unseen data.
Classification vs regression — what's the difference?
Tip: Give one example each — spam detection vs price prediction.
Classification predicts a discrete category, like spam vs. not spam. Regression predicts a continuous numeric value, like a house's price. The choice of algorithm and evaluation metric depends entirely on which type of problem you're solving.
What is a confusion matrix, and what do precision and recall mean?
Tip: Explain precision and recall with the "false alarm vs missed case" framing — it's easier to remember than the formulas.
A confusion matrix shows a classifier's predictions against actual outcomes — true/false positives and negatives. Precision measures how many predicted positives were actually correct, avoiding false alarms; recall measures how many actual positives were caught, avoiding missed cases — and there's usually a tradeoff between the two.
What is gradient descent?
Tip: Mention the learning rate explicitly — interviewers often follow up asking what happens if it's too high/low.
Gradient descent is an optimization algorithm that minimizes a model's error by iteratively adjusting parameters in the direction that reduces the loss the most. The learning rate controls the step size — too high can overshoot, too low can take forever to converge.
Decision tree vs random forest — what's the difference?
Tip: Say random forest = many trees + averaging — that one-liner is the core of the answer.
A decision tree splits data into branches to reach a prediction, but a single tree can easily overfit. A random forest builds many trees on random subsets of data and features, then averages or votes on their predictions — reducing overfitting and generally improving accuracy.
What is feature engineering, and why does it matter?
Tip: Give one concrete example — extracting "day of week" or "BMI" — abstract explanations alone feel weak here.
Feature engineering is creating, transforming, or selecting input variables to improve model performance — like extracting "day of week" from a timestamp, or combining height and weight into a BMI feature. Good feature engineering often improves accuracy more than switching to a fancier algorithm.
What is regularization (L1 vs L2)?
Tip: Mention that L1 can zero-out features (feature selection) while L2 shrinks them — that distinction is commonly asked.
Regularization adds a penalty term to the loss function to discourage overly complex models and reduce overfitting. L1 (Lasso) can shrink some coefficients all the way to zero, effectively doing feature selection, while L2 (Ridge) shrinks coefficients smoothly without zeroing them out.
⭐ Scenario: A model performs great on training data but poorly in production. How would you debug this?
Tip: This is scenario-based — walk through your diagnostic checklist step by step.
Situation: A model showed strong accuracy during training/validation but underperformed once deployed.
Task: I needed to find why the gap existed and close it without just retraining blindly.
Action: I checked whether production data distribution had drifted from training data, verified there was no data leakage in the original training/validation split, and confirmed the exact same preprocessing pipeline was applied at inference time as during training.
Result: I found a preprocessing mismatch — a feature was being computed slightly differently in production — and fixing that closed most of the performance gap.
InterviewEra generates role-specific questions using your actual projects and skills. Get scored feedback on technical depth, clarity, and structure — free to start.