Case 11 / Machine learning
Neural networks from first principles.
A NumPy-based framework that implements the mechanics behind dense and convolutional networks, from forward passes and gradients to training and image classification.
- Dense Networks
- CNN
- Backpropagation
- SGD
- Adam
- BatchNorm
- Dropout
- NumPy
- 01 / BUILDDefine layersDense, convolution, pooling, and residual components
- 02 / DIFFERENTIATEPropagate gradientsManual backward passes through the network
- 03 / OPTIMIZETrain modelsSGD, momentum, and Adam update parameters
- 04 / EVALUATEClassify imagesCompare dense and CNN results on two datasets
- Core numerical library
- NumPyno deep-learning framework for model layers
- CNN on MNIST
- 98.92%reported classification accuracy
- CNN on Fashion-MNIST
- 91.41%reported classification accuracy
Understand what a framework normally hides.
High-level libraries make it easy to assemble a network, but they also abstract away the calculations that make learning possible. This project implements those calculations directly with NumPy so each layer has an explicit forward pass and gradient computation.
The result is a small framework for experimenting with architectures and training behavior, not just a single classifier script.
Layers that can be composed and trained.
The codebase includes fully connected and convolutional layers, pooling, activation functions, normalization, dropout, and residual connections. Each component passes activations forward and gradients backward, allowing networks to be assembled from smaller parts.
- Dense networks provide a baseline for vectorized image classification.
- Convolution and pooling preserve local spatial structure in images.
- Residual connections explore deeper compositions and gradient flow.
- Regularization includes L2 penalties, dropout, and batch normalization.
Optimization is part of the implementation.
Training uses mini-batches and configurable optimizers rather than calling an external automatic-differentiation engine. Implemented update strategies include stochastic gradient descent, momentum, and Adam. This makes it possible to inspect how parameter updates, regularization, and model architecture affect learning.
Dense and convolutional baselines.
The repository reports image-classification accuracy on MNIST and Fashion-MNIST. Convolutional models perform better than the fully connected baselines in both reported experiments.
| Dataset | Fully connected | Convolutional |
|---|---|---|
| MNIST | 98.54% | 98.92% |
| Fashion-MNIST | 90.56% | 91.41% |
These figures demonstrate the framework on two familiar datasets; they are not a claim of state-of-the-art performance.
Built for learning and inspection.
The project emphasizes readable, inspectable implementations of neural-network mechanisms. A NumPy implementation is valuable for understanding and experimentation, but it is not intended to replace optimized production frameworks for large-scale training.