11 / 16

ML Foundations

The classical ML every ML system-design round still assumes you own.

0/12 studied
01Supervised learning, bias–variance & overfitting

Supervised learning fits a function from labeled examples; what matters is error on unseen data, so you hold data out to measure it and balance underfitting (high bias) against overfitting (high variance).

Core◇ Diagram</> Code
02Loss functions & gradient descent

Training means minimizing a loss: compute the gradient on a mini-batch and step weights the opposite way, scaled by the learning rate. Cross-entropy for classification, MSE for regression, AdamW with warmup for transformers.

Core◇ Diagram</> Code
03Regularization

Regularization trades a little training fit for better generalization: penalize large weights (L2/L1), inject noise (dropout, augmentation, label smoothing) or stop before the model memorizes (early stopping).

Core◇ Diagram</> Code
04Neural networks & backpropagation

A neural network stacks linear layers with nonlinear activations; backpropagation runs the chain rule backward from the loss to get every weight's gradient in one pass, which gradient descent then uses.

Core◇ Diagram</> Code
05Gradient-boosted trees (GBDT)

Build hundreds of small decision trees in sequence, each one fitting the errors the ensemble still makes; on tabular data XGBoost and LightGBM remain the default to beat.

Core◇ Diagram</> Code
06Feature engineering & data leakage

Turn raw events into signals a model can use (scaled numbers, encoded categories, crosses, time-window aggregates) while making sure no feature peeks at the label or the future.

Core◇ Diagram</> Code
07Class imbalance & calibration

When positives are rare, fix the metric and the threshold before the data; when decisions use the probability itself (auctions, expected loss), calibrate it so a score of 0.02 really means 2%.

Advanced◇ Diagram</> Code
08Learning to rank (LTR)

Train a model to order candidates for a query or user so the best land on top: pointwise, pairwise or listwise losses, LambdaMART as the workhorse, NDCG@k to measure, debiased clicks as labels.

Advanced◇ Diagram</> Code
09Exploration: multi-armed bandits

Choose among options one request at a time, shifting traffic toward the winners as evidence arrives, so you learn which is best while losing as little reward (regret) as possible.

Advanced◇ Diagram</> Code
10Computer vision: CNNs & Vision Transformers

A backbone (a CNN sliding small filters, or a ViT attending over image patches) turns pixels into features; task heads turn them into labels, boxes or masks. Start from a pretrained backbone.

Core◇ Diagram</> Code
11Contrastive learning & CLIP

Learn embeddings from pairs: pull matching items (image and caption, query and answer) together and push everything else in the batch apart. CLIP did this for images and text, enabling zero-shot classification and cross-modal search.

Advanced◇ Diagram</> Code
12Diffusion models

Train a network to predict the noise added to real data; generate by starting from pure noise and removing predicted noise step by step. Quality, steps and latency trade off directly.

Advanced◇ Diagram</> Code