Skip to content

Machine Learning Interview Questions for Data Science

10 Machine Learning questions with answers for data science roles. Tick what you have solved to track your progress.

Sheet progressStart practicing
01

What is the bias–variance trade-off?

Show answer
Bias is error from overly simple assumptions (underfitting). Variance is sensitivity to the training data (overfitting). More model complexity lowers bias but raises variance — aim for the lowest total error using cross-validation and regularization.
02

Explain precision vs recall. When would you prefer recall?

Show answer
Precision = TP / (TP + FP). Recall = TP / (TP + FN). Prefer recall when missing a positive is costly — for example disease screening or fraud detection.
03

Your dataset is highly imbalanced (2% positives). How do you handle it?

Show answer
Use stratified splits, class weights, resampling (SMOTE or undersampling) and threshold tuning, and judge the model with PR-AUC or F1 instead of accuracy.
04

What is the difference between bagging and boosting?

Show answer
Bagging trains models in parallel on bootstrap samples and averages them (reduces variance, e.g. Random Forest). Boosting trains models one after another, each fixing the previous errors (reduces bias, e.g. XGBoost).
05

What is regularization? Explain L1 vs L2.

Show answer
Regularization adds a penalty on weights to reduce overfitting. L1 (Lasso) adds |w| and can push features to exactly zero. L2 (Ridge) adds w² and shrinks weights smoothly.
06

Train accuracy is 95% but test accuracy is 70%. What do you do?

Show answer
This is overfitting. Check for data leakage, simplify the model, add regularization, get more data or augment it, use cross-validation, early stopping and feature selection.
07

Design an end-to-end churn prediction system.

Show answer
Define churn and the prediction window → build usage and billing features → handle imbalance → train gradient boosting → evaluate with PR-AUC and lift → explain with SHAP → deploy as batch scoring or an API → monitor drift → hand top-risk users to the retention team.
09

What is cross-validation and why use it?

Show answer
Split the data into k folds, train on k−1 folds and validate on the remaining one, rotate and average the scores. It gives a more reliable estimate than one split and helps tune hyperparameters without touching the test set.
10

What is gradient descent and what does the learning rate do?

Show answer
An optimisation method that updates weights in the opposite direction of the loss gradient. The learning rate sets the step size: too high and it diverges, too low and it is slow. Variants include SGD, mini-batch and Adam.