Interview Questions: Part 2
Math for ML.
Machine learning interviews also test the maths behind the models. Here are more questions, again with answers you could say in half a minute.

- The maths behind models
- More questions
- Half-minute answers
Bias, variance, and regularization
Explain the bias variance trade off. Simple models underfit, with high bias. Complex models overfit, with high variance. We want the balance that does best on new data. What's the difference between L one and L two regularization? L two shrinks all weights smoothly. L one can push weights to zero, selecting features.
| key | value |
|---|---|
| High bias | underfitting |
| High variance | overfitting |
| L2 / ridge | shrinks weights |
| L1 / lasso | zeros some weights |
Gradients and losses
How does gradient descent work? Compute the gradient of the loss, and step the weights in the opposite direction, scaled by the learning rate. Why use cross entropy for classification? It heavily punishes confident wrong answers, and gives good gradients with softmax. It's the negative log likelihood.
| key | value |
|---|---|
| Gradient descent | w ← w − lr × ∇loss |
| Too big lr | diverges |
| Cross-entropy | −log p(correct) |
| Equals | negative log likelihood |
Metrics and PCA
When is accuracy misleading? When classes are imbalanced, like fraud. Use precision, recall, or AUC instead. What does PCA do? It finds new uncorrelated directions, ordered by how much variance they capture, using the eigenvectors of the covariance matrix, so you can keep fewer features.
| key | value |
|---|---|
| Imbalanced | don't trust accuracy |
| Use | precision, recall, AUC |
| PCA | directions of max variance |
| From | covariance eigenvectors |
Summary
Know bias and variance, L one versus L two, gradient descent, cross entropy, metrics for imbalanced data, and PCA. Next, three practice projects that put it all together.
Key takeaways- Bias-variance
- Gradient descent
- PCA