Knowledge Bank · AI & GenAI

Python Machine Learning Interview Questions

By Karthick Selvam · Published

Frequently asked questions in Python and machine learning interviews.

What is overfitting and how do you prevent it?

When a model learns noise in training data and performs poorly on new data. Use cross-validation, regularisation, simpler models, more data and early stopping.

Explain the bias-variance trade-off.

Simple models may underfit (high bias); complex models may overfit (high variance). The goal is the best balance for unseen data.

How do you handle missing values?

Drop, impute (mean, median, model-based) or use algorithms that handle them, depending on why data is missing.

Precision vs recall?

Precision is the share of predicted positives that are correct; recall is the share of actual positives found.

What does a scikit-learn Pipeline do?

Chains preprocessing and modelling steps so they are applied consistently and without data leakage during cross-validation.

How do you deal with imbalanced classes?

Use appropriate metrics, resampling, class weights or threshold tuning.

Related programmes

Turn this into a team capability

Our corporate programmes cover topics like this hands-on, mapped to your stack.

Talk to us