Softmax, Loss, and Metrics Primitives
Build the numerically stable softmax, cross-entropy loss, and accuracy helpers used throughout the network.
Assemble a LeNet-style convolutional network with im2col convolutions, gradients, Adam, and a complete training loop.
Every source step is its own lesson with intuition, concepts, correctly rendered MathJax mathematics, implementation, tests, mistakes, and a checkpoint.
Build the numerically stable softmax, cross-entropy loss, and accuracy helpers used throughout the network.
Implement He initialization, zero biases, padding, output-shape math, and the im2col / col2im transforms that power efficient convolutions.
Code the forward and backward routines for convolution, max pooling, ReLU, flatten, and linear layers.
Fuse softmax with cross-entropy for stable training and implement both SGD and Adam parameter updates.
Compose the layer primitives into convolutional and classifier blocks, wire up the full LeNet forward/backward pass, and add a predict helper.
Generate a small synthetic image dataset and build shuffling, train/test splitting, and minibatch iteration utilities.
Tie everything together with a training step, epoch loop, full training driver, and a held-out evaluation routine.