🤖 Machine Learning Interview Questions

Master ML interviews with questions on algorithms, neural networks, model training, and deployment

15-Minute ML Cheatsheet

Quick reference for last-minute interview preparation

📚 Learning Paradigms

Supervised: Labeled data (classification, regression)
Unsupervised: No labels (clustering, dimensionality reduction)
Reinforcement: Learn from rewards/penalties
Semi-supervised: Mix of labeled + unlabeled
Self-supervised: Create labels from data itself

⚖️ Bias-Variance Tradeoff

High Bias: Underfitting, too simple
High Variance: Overfitting, too complex
Goal: Balance both for generalization
Fix Underfitting: More features, complex model
Fix Overfitting: Regularization, more data

🛡️ Regularization Techniques

L1 (Lasso): Sparsity, feature selection
L2 (Ridge): Small weights, prevents overfitting
Elastic Net: L1 + L2 combined
Dropout: Randomly disable neurons
Early Stopping: Stop before overfitting

🧠 Neural Network Essentials

Activations: ReLU, Sigmoid, Tanh, Softmax
Loss: MSE (regression), CrossEntropy (classification)
Optimizers: SGD, Adam, RMSprop
Backprop: Chain rule gradient descent
Batch Norm: Normalize layer inputs

📊 Evaluation Metrics

Classification: Accuracy, Precision, Recall, F1, AUC-ROC
Regression: MSE, RMSE, MAE, R²
Precision: TP / (TP + FP) - avoid false positives
Recall: TP / (TP + FN) - avoid false negatives
Cross-validation: K-fold for reliable estimates

🏗️ Common Architectures

CNN: Images - convolutions extract features
RNN/LSTM: Sequences - memory for time series
Transformer: Attention - NLP, long-range deps
GAN: Generator vs Discriminator
Autoencoder: Compression, anomaly detection

📐 Key Formulas to Remember

Sigmoid: σ(x) = 1 / (1 + e⁻ˣ)
Softmax: eˣⁱ / Σeˣʲ
Cross-Entropy: -Σ y·log(ŷ)
MSE: Σ(y - ŷ)² / n
Gradient Descent: w = w - α·∂L/∂w
F1 Score: 2·(P·R)/(P+R)

⚠️ Common Interview Questions

• Why is data preprocessing important?
• Explain the curse of dimensionality
• How do you handle imbalanced datasets?
• Difference between bagging vs boosting?
• When to use L1 vs L2 regularization?
• How does batch size affect training?

Supervised Learning: Learning from labeled data (input-output pairs). The model learns to map inputs to correct outputs.

Examples: Classification (spam detection), Regression (price prediction)

Unsupervised Learning: Learning patterns from unlabeled data. The model discovers hidden structure.

Examples: Clustering (customer segmentation), Dimensionality reduction (PCA)

Reinforcement Learning: Learning through trial and error with rewards/penalties. Agent learns optimal actions in an environment.

Examples: Game playing (AlphaGo), Robotics, Self-driving cars

Python

Neural networks learn by adjusting weights through backpropagation - computing gradients of loss with respect to weights using the chain rule, then updating weights via gradient descent.

Python

Overfitting: Model learns training data too well, including noise. Poor generalization to new data.

Underfitting: Model is too simple to capture underlying patterns. Poor performance on both training and test data.

Regularization: Techniques to prevent overfitting by adding constraints.

Python

CNNs use convolutional layers to automatically learn hierarchical features from images. They're highly effective for computer vision tasks.

Python

MLOps brings DevOps practices to machine learning, focusing on automation, monitoring, and reproducibility of ML systems in production.

Python

Interview Tips for Machine Learning