ML coding
Machine learning algorithms and model parts written from scratch in NumPy and PyTorch, as ML coding rounds ask.
Machine learning algorithms and model parts written from scratch in NumPy and PyTorch, as ML coding rounds ask.
6 write-ups
| Title |
|---|
| NumPy Essentials The NumPy you need to write ML code from scratch under time pressure: dtypes and views, broadcasting, turning loops into axes, axis arguments, einsum and fancy indexing. |
| PyTorch Essentials The PyTorch you need for an ML coding round: tensors versus arrays, autograd and accumulating gradients, nn.Module and parameters, devices, no_grad and eval, and the four lines of a training step. |
| Numerical Stability Why exp overflows and log underflows, and the fixes interviewers look for: log-sum-exp, stable softmax and sigmoid, losses from logits, sized epsilons, and float16 and bfloat16 pitfalls. |
| Getting Shapes Right Habits that keep shapes right in ML code: name every dimension, assert at boundaries, spot broadcasts that hide bugs, reshape versus transpose, and test on tiny inputs with sizes that all differ. |
| Checking Gradients How to prove a hand-written backward pass is right: central finite differences, choosing the step, relative error and its thresholds, kinks and randomness, and gradcheck in PyTorch. |
| Debugging ML Code The find-the-bugs variant of the ML coding round: how to work it, and the bugs it plants: silent broadcasts, wrong axes, off-by-one masks, leaking state, and a loss that won't fall. |