A machine learning interview should test whether a candidate can explain why a method fits a data problem and what evidence would reveal its weaknesses. Definitions matter, but production-oriented answers also need data assumptions, evaluation, security and deployment trade-offs. This guide revisits the main questions covered in the original 2025 article with explicit technical reasoning, not unverified compensation promises or claims about interview question frequency.
Foundational learning and model behavior
1. What is the difference between supervised and unsupervised learning?
Supervised learning fits a relationship between inputs and known targets, such as predicting whether a ticket is urgent. Unsupervised learning identifies structure without those labeled targets, such as grouping customers by behavior. Evaluation differs: supervised methods can compare predictions with held-out labels, while unsupervised groups need measures of stability and business usefulness rather than simply an accuracy score.
2. What are bias and variance?
Bias refers to error introduced by restrictive modeling assumptions and can lead to underfitting. Variance describes sensitivity to a particular training sample and can produce overfitting. A very simple model may miss a nonlinear pattern; an excessively flexible model can fit random noise. Compare train and validation performance across model complexity and data size rather than assume that a larger model always improves generalization.
3. How does the bias–variance trade-off affect model choice?
Increasing complexity may reduce training error while increasing sensitivity to noise. Regularization, more representative data, cross-validation and simpler features can improve generalization. There is no fixed point where every model is optimal; use validation evidence and application constraints such as latency, interpretability and maintenance cost.
4. How do K-nearest neighbors and k-means differ?
K-nearest neighbors is commonly a supervised method that predicts using labeled nearby examples. k-means is an unsupervised clustering algorithm that assigns observations to cluster centers. Both use a parameter written k, but the meaning and output differ. Feature scaling can strongly affect distance-based methods, and k-means clusters should not be interpreted as known categories without validation.
Metrics and statistical reasoning
5. What do precision and recall measure?
Precision is the fraction of predicted positives that are truly positive. Recall is the fraction of actual positives detected. In fraud screening, a high-recall model can find more suspicious transactions but may generate more investigations. The preferred threshold depends on the costs of missed cases, false alarms and the available review capacity.
6. When is F1 more useful than accuracy?
F1 is the harmonic mean of precision and recall. It can reveal weak positive-class performance when overall accuracy is dominated by frequent negatives. However, F1 treats precision and recall symmetrically; if false negatives are much more expensive than false positives, the business may need a weighted measure or an explicitly cost-sensitive threshold instead.
7. How should you interpret ROC and precision–recall curves?
An ROC curve plots true positive rate against false positive rate across thresholds, and its area measures ranking discrimination. A precision–recall curve can be more informative when the positive class is rare and the operational emphasis is finding those cases. Neither curve alone proves the chosen decision threshold is right for the business, and ranking performance does not establish probability calibration.
8. What are Type I and Type II errors?
In statistical hypothesis testing, a Type I error rejects a true null hypothesis; a Type II error fails to reject a false null. These relate to, but are not interchangeable with, classification false positives and false negatives. Specify the hypothesis and decision context before using the labels, because ambiguous wording can reverse what a team believes it is optimizing.
9. Why is Bayes’ theorem important?
Bayes’ theorem updates beliefs about a hypothesis using evidence and the prior probability of that hypothesis. A test with high sensitivity can still have a low positive predictive value when the underlying event is rare. In a spam or disease screening discussion, account for the base rate instead of claiming that a strong test automatically makes every positive result very likely.
Algorithms, regularization and model families
10. What is the difference between L1 and L2 regularization?
L1 penalties can encourage sparse coefficients, setting some weights to zero under relevant optimizers. L2 penalties discourage large coefficients more smoothly. Their effect depends on feature scaling, model and strength parameter. Regularization is usually selected through validation; it does not automatically correct leakage, class imbalance or a badly defined target.
11. How does naïve Bayes work?
Naïve Bayes applies Bayes’ theorem with a simplifying conditional-independence assumption between features given the class. It can be effective for some text-classification tasks despite the assumption being imperfect. The interviewer should expect discussion of model variants, input representations and why correlated features or poorly estimated class priors can affect interpretation.
12. What is the difference between discriminative and generative models?
A discriminative model commonly learns a decision boundary or conditional target relationship, while a generative model seeks to represent or generate aspects of a data distribution. The terms are broader than modern text generators alone. A generative language model can produce fluent content that is wrong, so application validation remains necessary even when generation quality appears high.
13. When should you choose classification instead of regression?
Classification predicts discrete categories; regression estimates continuous or numeric outcomes. Predicting whether inventory will run out is a classification task, while predicting the number of units needed is regression. A dataset’s label formatting should reflect the intended business decision rather than force a popular algorithm onto the problem.
14. What does ensemble learning add?
An ensemble combines multiple learners to improve predictions, often reducing variance or capturing complementary patterns. Bagging methods, random forests and gradient boosting have different training and error behavior. Ensembles can improve performance but increase complexity, explanation difficulty and serving cost. Compare them against a simple baseline and test overfitting.
15. What is the role of the Fourier transform?
The Fourier transform represents a signal in terms of frequency components. It can help analyze periodicity in sensor, audio or other time-series data, but frequency-domain features are useful only when they match the task and sampling assumptions. Windowing, aliasing and irregular sampling complicate the interpretation. It is not a universal model-improvement technique.
16. How does deep learning differ from classical ML?
Deep neural networks use multiple parameterized layers to learn complex representations and can be powerful for images, language and audio. Classical methods such as trees, linear models and nearest neighbors often remain strong for smaller or structured datasets. The choice should consider training volume, compute costs, inference latency, explainability and whether the improvement is demonstrated on realistic held-out data.
Data quality, evaluation and production reasoning
17. How should a team handle an imbalanced dataset?
First ask whether class prevalence in the sample represents deployment. Use appropriate metrics, stratified validation when compatible with the problem, class weighting, resampling within training folds, or threshold adjustment according to costs. Oversampling before splitting can leak duplicates into validation. Synthetic examples should be evaluated for plausibility and privacy.
18. What is data leakage?
Leakage occurs when training features or preprocessing use information unavailable at prediction time or improperly draw from evaluation data. Fitting a scaler before splitting or using a later customer outcome as an input can inflate scores. Use time-aware or group-aware splits where appropriate, fit transformations within training folds, and validate the actual information available in production.
19. What does a good model evaluation include beyond one score?
Include relevant class or group metrics, uncertainty or variation across validation runs, calibration when scores are treated as probabilities, latency and failure behavior. Examine representative errors and compare with a simple baseline. A technically good aggregate score may hide unacceptable performance for a small but important business case.
20. What changes once a model is deployed?
The system must handle schema changes, model artifacts, versioning, access permissions, load, latency and input or concept drift. A healthy endpoint can serve increasingly poor predictions after data or behavior changes. Define rollback triggers, monitoring and the owner responsible for deciding when retraining is necessary.
A broader machine learning pipeline tutorial covers preparing and training candidates, while AWS deployment and optimization addresses operational concerns. Those contexts are useful when an interview moves from definitions to implementation trade-offs.
Interview preparation is strongest when a candidate answers with an example, a failure mode and a measurement. If a claim depends on a current cloud feature, check the provider’s latest documentation. A confident but incorrect product assertion is less persuasive than a well-defined assumption and a repeatable test.