Path
AI Practice
Implement the pieces of machine learning in Python and numpy, from losses and optimizers to attention-adjacent layers, each graded on real results.
See all 51 practice problems — 16 with a graded lab →
By Deboistech 16 labs 3 h 51 minIntermediate
Showing 1 of 16 labs.
- Subscription Linear regression by gradient descent Write the mean squared error, its gradients, and the descent loop that logs the cost.
- Subscription Train softmax regression on blobs Train a multi-class classifier on four clusters until it scores well on points it never saw.
- Subscription Train a 2-4-1 network on XOR Add a hidden layer and backpropagation so a tiny network learns what a straight line cannot.
- Subscription Stable softmax and cross-entropy Write a softmax that survives huge logits, the cross-entropy loss and its gradient.
- Subscription Focal loss Down-weight easy examples: binary and multi-class focal loss, stable, with a gradient.
- Subscription SGD with momentum Write one momentum update, then a loop that minimises a quadratic, with Nesterov lookahead.
- Subscription Inverted dropout Zero random activations while training and scale the rest, so inference needs no change.
- Subscription Sweep the learning rate Run gradient descent at eight step sizes, find the best and the first that blows up.
- Subscription Sinusoidal positional encoding Build the sine and cosine position table and add it to a batch of token embeddings.
- Subscription LayerNorm and RMSNorm Write the two normalisation layers transformers use, with eps in the right place.
- Subscription Sweep the sampling temperature Measure how temperature changes a language model's next-token distribution.
- Subscription Discounted returns with episode ends Compute reward-to-go for one episode, for joined episodes, and normalise the result.
- Subscription Q-learning and SARSA updates Write the two tabular update rules and an epsilon-greedy action picker.
- Subscription A LoRA linear layer Add a low-rank adapter to a frozen layer, merge it back, and count what you train.
- Subscription Cosine similarity top-k search Normalise embeddings and return the k most similar documents with a fixed tie rule.
- Subscription Reciprocal rank fusion Merge several ranked lists into one, with optional weights and a fixed tie rule.
