Machine Learning Interview Questions & Answers
All 200 unique questions in one place — 54 easy, 101 medium, 45 hard — grouped by topic.
Practise by topic
Practise the way your interview works
Explain supervised, unsupervised and reinforcement learning with one example each.
Show answer
What is the difference between a regression and a classification problem?
Show answer
What are overfitting and underfitting, and how do you detect them?
Show answer
Why do we split data into training, validation and test sets?
Show answer
What is the difference between parameters and hyperparameters?
Show answer
How do you set up a basic train-test split with scikit-learn?
Show answer
Write a minimal scikit-learn workflow to train and evaluate a model.
Show answer
How would you build a quick baseline before trying complex models?
Show answer
Why do you want to work as a machine learning engineer?
Show answer
What is the bias-variance trade-off?
Show answer
What is a loss function? Name common ones for regression and classification.
Show answer
Explain gradient descent and the role of the learning rate.
Show answer
What is the difference between batch, stochastic and mini-batch gradient descent?
Show answer
What is the curse of dimensionality?
Show answer
Your model shows 99 percent training accuracy but 72 percent validation accuracy. What will you do?
Show answer
A business stakeholder asks you to use deep learning for a 5,000-row tabular dataset. How do you respond?
Show answer
You are asked to predict customer churn. How would you frame the ML problem from scratch?
Show answer
Leadership wants a model in one week, but data quality is poor. How do you handle it?
Show answer
How do you implement simple gradient descent for linear regression in NumPy?
Show answer
How do you make an ML experiment reproducible?
Show answer
Tell me about a time your model did not work as expected. What did you do?
Show answer
What is the no free lunch theorem and what does it mean in practice?
Show answer
What is the difference between a generative and a discriminative model?
Show answer
Your training loss is not decreasing at all. What could be wrong?
Show answer
Why is feature scaling needed and which algorithms need it?
Show answer
What is the difference between standardisation and normalisation?
Show answer
How do you handle missing values in a dataset?
Show answer
What is one-hot encoding and when can it cause problems?
Show answer
What is feature engineering and why does it matter?
Show answer
How do you extract useful features from a datetime column in pandas?
Show answer
How do you find and remove duplicate rows and check missing values in pandas?
Show answer
How do you explain data cleaning decisions to a non-technical manager?
Show answer
What is the difference between label encoding and ordinal encoding?
Show answer
What is data leakage? Give two examples.
Show answer
How do you detect and treat outliers?
Show answer
Compare filter, wrapper and embedded feature selection methods.
Show answer
What is multicollinearity and how do you detect it?
Show answer
Why do skewed features often need a log or power transform?
Show answer
Your dataset has a city column with 2,000 unique values. How will you encode it?
Show answer
Validation AUC is 0.99 on a loan default model. What do you suspect?
Show answer
40 percent of values in an important income column are missing. What do you do?
Show answer
How do you build a scikit-learn pipeline for mixed numeric and categorical data?
Show answer
How do you calculate VIF for features in Python?
Show answer
How do you select the top k features using mutual information in scikit-learn?
Show answer
Describe a time you found a serious data quality issue late in a project.
Show answer
How would you encode cyclical features like hour of day or month?
Show answer
What is target encoding and how do you avoid leakage with it?
Show answer
New categories appear in production that were not in training data. How do you handle it?
Show answer
Your preprocessing works in notebooks but gives different results in production. Why?
Show answer
What are the assumptions of linear regression?
Show answer
What is R-squared and what is adjusted R-squared?
Show answer
Compare MAE, MSE and RMSE as regression metrics.
Show answer
How do you interpret a coefficient in a multiple linear regression?
Show answer
Fit a linear regression in scikit-learn and print RMSE and R-squared.
Show answer
How do you check regression residuals visually in Python?
Show answer
How does ordinary least squares find the regression coefficients?
Show answer
What is the difference between Ridge, Lasso and Elastic Net regression?
Show answer
What is polynomial regression and what risk does it carry?
Show answer
What is heteroscedasticity and why does it matter?
Show answer
How do you approach a time series forecasting problem differently from normal regression?
Show answer
Your house price model's residuals grow larger for expensive houses. What do you do?
Show answer
A demand forecast is consistently under-predicting during festivals. How would you fix it?
Show answer
Two models have RMSE 120 and 125, but the second has much lower MAE. Which do you choose?
Show answer
How do you tune the alpha of Ridge regression using cross-validation?
Show answer
How do you create polynomial features with regularisation in a pipeline?
Show answer
Use statsmodels to get p-values for regression coefficients.
Show answer
Tell me about a time you had to explain a model's error to a business team.
Show answer
How do you handle disagreement with a senior colleague about model choice?
Show answer
What is regularisation in general and why does it reduce overfitting?
Show answer
Why does L1 regularisation produce sparse models while L2 does not?
Show answer
When would you use Huber or quantile regression instead of OLS?
Show answer
Lasso dropped a feature the business considers very important. How do you handle it?
Show answer
You need prediction intervals, not just point estimates, for delivery time. How?
Show answer
How do you create lag and rolling features for a sales forecasting model in pandas?
Show answer
How does logistic regression work?
Show answer
Why is logistic regression called regression if it is used for classification?
Show answer
Explain the k-nearest neighbours algorithm and its weaknesses.
Show answer
What is Naive Bayes and why is it called naive?
Show answer
What is a confusion matrix?
Show answer
Explain precision, recall and F1 score.
Show answer
A fraud model has 99.6 percent accuracy, but the business says it is useless. Why?
Show answer
You must build a spam classifier quickly with limited compute. What do you choose?
Show answer
Print a confusion matrix and classification report in scikit-learn.
Show answer
How do you plot an ROC curve and get AUC in scikit-learn?
Show answer
How do you keep learning new ML techniques while working full time?
Show answer
How does a support vector machine work?
Show answer
What is the ROC curve and AUC? When is PR-AUC better?
Show answer
How do you handle class imbalance?
Show answer
How do one-vs-rest and multinomial approaches differ for multiclass classification?
Show answer
The fraud team can only review 500 alerts a day. How do you set the threshold?
Show answer
How do you choose a classification threshold that maximises F1?
Show answer
How do you build a text classifier with TF-IDF and logistic regression?
Show answer
Tell me about a time you balanced model accuracy against a business constraint.
Show answer
What is the softmax function?
Show answer
What is the kernel trick?
Show answer
What is probability calibration and why does it matter?
Show answer
Your classifier works well overall but poorly for one customer segment. What do you do?
Show answer
A credit model's probability of 0.3 is used to set interest rates, but defaults in that band are 12 percent. What is wrong?
Show answer
How do you apply SMOTE correctly without leakage?
Show answer
How does a decision tree decide where to split?
Show answer
What is the difference between Gini impurity and entropy?
Show answer
Why do single decision trees overfit and how do you control it?
Show answer
Explain bagging and how a random forest uses it.
Show answer
Train a random forest and show feature importances in scikit-learn.
Show answer
Visualise a small decision tree and its rules.
Show answer
What is boosting and how is it different from bagging?
Show answer
How does gradient boosting work?
Show answer
What makes XGBoost, LightGBM and CatBoost different?
Show answer
Your random forest model file is 2 GB and too slow for real-time scoring. What can you do?
Show answer
XGBoost validation loss starts rising after 300 rounds while training loss keeps falling. What do you do?
Show answer
Random forest and LightGBM give the same AUC. Which would you deploy?
Show answer
Train LightGBM with early stopping.
Show answer
Compute permutation importance on validation data.
Show answer
Describe a project where you improved a model's performance significantly.
Show answer
How do you decide when a model is good enough to stop tuning?
Show answer
When would you use AdaBoost and how does it re-weight samples?
Show answer
Use HistGradientBoosting with native categorical support in scikit-learn.
Show answer
Which hyperparameters matter most when tuning a gradient boosting model?
Show answer
Why can impurity-based feature importance be misleading?
Show answer
What is stacking and when is it worth it?
Show answer
Business users do not trust a gradient boosting model because it is a black box. How do you help?
Show answer
Your tree model predicts higher risk for customers with higher income, which is illogical. What do you do?
Show answer
Explain a single prediction with SHAP for a tree model.
Show answer
Your gradient boosting model performs worse on recent months than older ones. What do you check?
Show answer
How does k-means clustering work?
Show answer
How do you choose the number of clusters k?
Show answer
Run k-means and plot the elbow and silhouette scores.
Show answer
What is DBSCAN and when is it better than k-means?
Show answer
Explain hierarchical clustering and dendrograms.
Show answer
What is PCA and how does it work?
Show answer
How does Isolation Forest detect anomalies?
Show answer
What is association rule mining? Explain support, confidence and lift.
Show answer
Marketing wants customer segments for campaigns. How do you approach it?
Show answer
k-means gives one huge cluster and several tiny ones. What could be wrong?
Show answer
Your dataset has 800 correlated features and the model trains slowly. What would you do?
Show answer
Apply PCA and check explained variance.
Show answer
Detect anomalies with Isolation Forest.
Show answer
Build RFM features for customer segmentation in pandas.
Show answer
Tell me about a time your analysis was not used by stakeholders. What did you learn?
Show answer
How do you prioritise when several teams ask you for models at the same time?
Show answer
A product team wants 'similar products' recommendations with no purchase labels. How would you start?
Show answer
Find the most similar items using cosine similarity.
Show answer
What is the difference between PCA and t-SNE or UMAP?
Show answer
What is a Gaussian Mixture Model and how is it different from k-means?
Show answer
How do you evaluate clustering when there are no labels?
Show answer
You need to detect unusual transactions but have no fraud labels. What do you do?
Show answer
The segments you built six months ago no longer match customer behaviour. What do you do?
Show answer
Run DBSCAN and count clusters and noise points.
Show answer
What is Local Outlier Factor and how does it differ from Isolation Forest?
Show answer
What is k-fold cross-validation and why is it better than a single split?
Show answer
What is a holdout set and why should it be touched only once?
Show answer
Run stratified 5-fold cross-validation with multiple metrics.
Show answer
Tune a pipeline with GridSearchCV.
Show answer
How do you explain the precision-recall trade-off to a business manager?
Show answer
When should you use TimeSeriesSplit or GroupKFold instead of normal k-fold?
Show answer
Compare grid search, random search and Bayesian optimisation.
Show answer
What are learning curves and validation curves?
Show answer
What is the log loss metric and why is it useful?
Show answer
What is the difference between offline evaluation and online A/B testing of a model?
Show answer
A new model has slightly better AUC but worse precision in the top 1,000 cases the team acts on. Which do you pick?
Show answer
Grid search with 5 hyperparameters is taking two days. How do you speed it up?
Show answer
Your manager asks for a single number showing the model's business value. What do you give?
Show answer
Plot a learning curve in scikit-learn.
Show answer
Check calibration with a reliability curve and Brier score.
Show answer
Tell me about a time you discovered your own mistake after sharing results.
Show answer
What is nested cross-validation and when do you need it?
Show answer
How do you compare two models fairly?
Show answer
What fairness checks would you run on a model that affects people?
Show answer
Your cross-validation score is 0.85 but the test score is 0.70. What could explain it?
Show answer
An A/B test of a new recommendation model shows no significant uplift despite better offline metrics. What next?
Show answer
Tune LightGBM with Optuna.
Show answer
Get a bootstrap confidence interval for a test metric.
Show answer
How do you handle pressure to report better model numbers than the data supports?
Show answer
Explain the bias in AUC when classes are extremely imbalanced, with a numeric intuition.
Show answer
What does it mean to deploy a machine learning model?
Show answer
How do you save and load a scikit-learn model?
Show answer
What is MLOps?
Show answer
Why containerise an ML model with Docker?
Show answer
How do you work with data engineers and software engineers on an ML project?
Show answer
What is data drift and concept drift?
Show answer
What is a model registry and why is it useful?
Show answer
Compare batch scoring and real-time inference.
Show answer
What are shadow deployment and canary release for models?
Show answer
What should you monitor for a model in production?
Show answer
A model's accuracy dropped 10 percent over three months in production. How do you investigate?
Show answer
A new model version performs badly right after release. How do you handle it?
Show answer
Your team retrains models manually in notebooks every month. How would you improve it?
Show answer
Serve a scikit-learn model with FastAPI.
Show answer
Write a simple Dockerfile for an ML API.
Show answer
Log a training run to MLflow.
Show answer
Write a unit test for a model prediction function.
Show answer
Tell me about a time you took a model from notebook to production.
Show answer
Tell me about a time a production model failed and how you communicated it.
Show answer
What is training-serving skew and how do you prevent it?
Show answer
Your real-time model API takes 400 ms but the requirement is under 50 ms. What do you do?
Show answer
Labels for your loan model arrive only after 6 months. How do you monitor it meanwhile?
Show answer
Your model must run on a mobile app with no internet. What do you consider?
Show answer
Calculate the Population Stability Index for a feature.
Show answer
What is a feature store and when is it needed?
Show answer
Frequently asked questions
What jobs can I get after learning machine learning?
Common entry roles are Junior ML Engineer, Data Scientist trainee, Applied ML Analyst and AI/ML associate in IT services. With experience you can grow into Machine Learning Engineer, MLOps Engineer, Senior Data Scientist and Lead Data Scientist. Hiring comes from product companies, banks and fintechs, e-commerce firms, analytics consultancies and IT services companies building AI solutions for global clients. Strong projects and solid fundamentals matter more than the job title you start with.
Who is eligible to learn machine learning?
Graduates and final-year students from B.Tech, BCA, MCA, B.Sc, M.Sc, statistics, economics or commerce backgrounds can learn ML, as can working professionals in software, analytics or testing. You need basic school-level maths and comfort with logical thinking; Python, statistics and linear algebra are taught from the basics in the early phases. Non-IT learners usually need a little extra practice time on Python and statistics before the modelling phases.
How long does it take to learn machine learning for a job?
With 2 to 3 hours of daily practice, most learners become job-ready for entry roles in about four to six months: around 16 weeks of structured learning plus time for projects and interview preparation. Working professionals with a Python background often move faster. Becoming strong in deployment and MLOps, or in deep learning, takes additional months of hands-on work on real or realistic datasets.
Do I need to know deep learning to get an ML job?
Not for most entry and mid-level roles that work on tabular business data. Interviews focus heavily on preprocessing, classical algorithms, gradient boosting, evaluation metrics and deployment basics. Deep learning becomes important for computer vision, NLP and generative AI roles. A good path is to master classical ML with scikit-learn first, then add neural networks and transformers as a second step.
Is a certification useful for machine learning jobs?
A certificate helps your resume pass initial screening, and cloud certifications such as AWS Machine Learning or Azure AI Engineer add value for MLOps roles. However, recruiters mainly judge you on projects, GitHub code, Kaggle or similar work, and how well you explain your choices in interviews. Treat certification as a supporting signal and invest most of your effort in two or three solid end-to-end projects.
What projects should I build to get shortlisted?
Build two or three end-to-end projects instead of many small notebooks. Good choices are a churn or credit default model with proper pipelines and threshold tuning, a demand forecast with lag features and time-based validation, and a customer segmentation with business profiling. At least one project should be deployed as an API with Docker, include a README with metrics and decisions, and be easy for an interviewer to run.