This project demonstrates the implementation of a simple neural network from scratch using Python and numpy
for mathematical operations. The neural network is trained on the MNIST dataset to classify handwritten digits (0-9).
No deep learning libraries like TensorFlow or PyTorch were used; the focus is on understanding the fundamentals of neural networks and backpropagation.
NeuralNetwork
class: Manages the forward propagation, backpropagation, parameter updates, and training iterations.Layer
class: Represents a single layer of the network with activation functions, weights, and biases.
- Initialize the neural network.
- Add layers with specific configurations.
- Train using gradient descent with a fixed or adaptive number of iterations.
- Evaluate and predict using the trained model.
- Forward Propagation: Computes the output of each layer by applying activation functions.
- Backpropagation: Calculates gradients for weights and biases using the chain rule and updates them to minimize loss.
- Training Modes:
- Fixed Iterations: Runs for a predetermined number of iterations.
- Adaptive: Stops training once accuracy stabilizes or fails to improve for a defined number of iterations.
The MNIST dataset consists of 70,000 images of handwritten digits (28x28 pixels) and their labels. It is a standard benchmark dataset for testing machine learning algorithms.