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 |
|---|
| An MLP with Backprop by Hand A one-hidden-layer ReLU network with softmax cross-entropy in NumPy, backprop by hand from a per-example loop to modular layers, checked against finite differences and PyTorch. |
| Softmax and Cross-Entropy A stable softmax and cross-entropy in NumPy, from the formula that overflows to log-sum-exp, the combined gradient with respect to the logits, label smoothing and one gradient step. |
| Optimizers: SGD, Momentum, Adam SGD, momentum, Adam and AdamW in NumPy, with bias correction, L2 against decoupled weight decay, warmup and cosine schedules, checked against torch.optim. |
| BatchNorm and LayerNorm BatchNorm in NumPy with train and eval modes, running statistics and a hand-derived backward pass, then LayerNorm and RMSNorm, all checked against PyTorch. |
| Dropout and Regularization Inverted dropout as a NumPy layer with train and eval modes and a backward pass, then L2 regularization and early stopping on a model that overfits, with tests and PyTorch checks. |
| Conv2D from Scratch A 2D convolution forward pass in NumPy with padding and stride, from six nested loops to im2col and one matrix product, plus max pooling, the backward pass and tests against PyTorch. |