83 Machine Learning & DS interview questions with answers
83 Machine Learning & DS interview questions with detailed answers, sorted from basic to advanced. Free to practice, with progress saved automatically.
All Machine Learning & DS interview questions
What is Mixture of Experts (MoE)? How does it differ from dense models?
What is Flash Attention? Why does it speed up training/inference without changing results?
What is RoPE (Rotary Position Embedding)? Why is it preferred over learned positional embeddings?
Scaling laws and emergent abilities: why do larger LLMs unlock new capabilities?
What is the bias-variance tradeoff?
What is overfitting and how do you prevent it?
What is a confusion matrix? Distinguish precision, recall, and F1-score.
What are the ROC curve and AUC?
What is cross-validation? Compare k-Fold, Leave-One-Out, and Hold-Out.
What is regularization? Distinguish L1 (Lasso), L2 (Ridge), and Elastic Net.
Distinguish feature engineering from feature selection.
What is the curse of dimensionality and how do you address it?
How do you handle an imbalanced dataset? How does SMOTE work?
What are the roles of train/validation/test sets, and what is data leakage?
Gradient descent: distinguish batch, stochastic (SGD), and mini-batch.
What is the precision-recall tradeoff and threshold tuning?
Regression metrics: MSE, RMSE, MAE, and R²?
How does linear regression work, and what assumptions does it rely on?
Why is logistic regression a classification algorithm despite the word "regression" in its name?
Distinguish bagging from boosting; how do random forests and bootstrapping relate?
How do AdaBoost, gradient boosting, and XGBoost differ?
How does K-Means work, and how do you choose the optimal number of clusters k?
What does PCA do, and why does it maximize variance?
How does K-Nearest Neighbors work, and why is KNN called a "lazy" algorithm?
How do SVMs work, and what is the kernel trick?
How does a decision tree choose splits (entropy/gini), and why is pruning needed?
What is the difference between supervised, unsupervised, and reinforcement learning?
How does Naive Bayes work, and what is its "naive" independence assumption?
In ensemble learning, how do voting and stacking differ?
Compare K-Means, DBSCAN, and hierarchical clustering.
What is the Central Limit Theorem and why does it matter?
What is a p-value? Distinguish Type I and Type II errors.
Does correlation imply causation? Distinguish covariance and correlation.
How does hypothesis testing work (H0/H1, significance level α)?
What is the normal distribution, and what is a z-score for?
What is a confidence interval, and how do you interpret it correctly?
What are Bayes' theorem and conditional probability?
What sampling methods exist, and what is sampling bias?
Descriptive statistics: distinguish mean/median/mode and variance/std.
What are skewness and kurtosis?
A/B testing: how do you design the experiment and read the results correctly?
What are vanishing and exploding gradients, why do they happen, and how do you fix them?
Compare SGD + momentum, Adagrad, RMSProp, and Adam; when do you use each?
What is batch normalization, how does it work, and what benefits does it bring?
How do dropout and early stopping combat overfitting?
Explain convolution, kernel, stride, padding, and pooling in a CNN.
How do RNN, LSTM, and GRU differ, and what problem does LSTM solve?
How does a GAN work, and what are the roles of the generator and discriminator?
How do an autoencoder and a variational autoencoder (VAE) differ?
ReLU, sigmoid, tanh, and softmax: characteristics and when to use each?
How does backpropagation work?
Why does weight initialization matter, and how does Xavier/Glorot differ from He initialization?
How do cross-entropy and MSE differ, and when do you use each?
Distinguish epoch, batch, and iteration; what are learning rate and scheduling?
What is a Markov Decision Process (MDP), and what does the Bellman equation state?
Distinguish Q-Learning from SARSA (off-policy vs on-policy).
Compare value-based and policy-based methods in RL.
What is the exploration vs exploitation trade-off, and how does ε-greedy work?
Explain the core RL concepts: reward, policy, value function, discount factor γ.
Distinguish model-free from model-based RL.
What is a Deep Q-Network (DQN)? The core idea and its stabilizing tricks.
What is ARIMA, and why does stationarity matter in time series?
Distinguish collaborative filtering from content-based filtering in recommender systems.
What strategies exist for handling missing data?
Compare one-hot, label, and target encoding for categorical variables.
Feature scaling: distinguish normalization from standardization, and when is it needed?
Distinguish parametric from non-parametric models.
From a learning curve, how do you tell whether a model has high bias or high variance, and what do you do in each case?
Why should you build a simple baseline before reaching for a complex model? What goes into a baseline?
Which models require feature scaling and which do not? Why?
A fraud-detection task has 0.5% positive samples. Why does 99.5% accuracy say nothing, and which metrics should you report?
When should you use PR-AUC instead of ROC-AUC? Why can ROC-AUC look good on highly imbalanced data?
What forms of data leakage are common in practice, and how do you prevent them?
A classifier outputs probabilities. Why is 0.5 not the right default threshold, and how do you choose one?
For imbalanced data, how do you choose between oversampling, undersampling and class weights? When is no intervention needed?
Why can you not use random k-fold on time-series data? How do you validate it correctly?
A model performs well on the test set but degrades after a few months in production. What are the likely causes and how do you investigate?
How should outliers be handled? Should they always be removed?
How do you explain a model to non-technical stakeholders? What is wrong with a random forest's default feature importance?
How do you encode a categorical variable with tens of thousands of levels (product code, district, user id)? How does target encoding leak and how do you fix it?
When is manual feature engineering worth the effort, and when should you let the model learn representations?
A colleague reruns your training code and gets different results. What sources of non-reproducibility should you check, and how do you fix them?
What does it take to put a trained model into production (serving, monitoring, retraining)?