This repository contains my implementation of a neural network for classifying handwritten digits, built as part of my learning journey through neural networks and deep learning.
The goal of this project is to build a simple neural network from scratch, capable of classifying handwritten digits (0-9) from the popular MNIST dataset. The project was inspired by a couple of excellent resources that guided me through the theoretical and practical aspects of neural networks.
- Implementation of a basic feedforward neural network.
- Backpropagation for training.
- The network is trained to classify digits from the MNIST dataset.
- No external deep learning libraries (like TensorFlow or PyTorch) were used — the implementation was done from scratch using
NumPy. - Option to save & load model
I used the following resources to guide me through understanding and building neural networks:
-
Book: Neural Networks and Deep Learning by Michael Nielsen
- This book was instrumental in understanding the mathematics and concepts behind neural networks and their implementation from scratch.
-
Video Series: 3Blue1Brown's YouTube Playlist on Neural Networks
- This series visually explains neural networks and backpropagation in an intuitive way, helping me understand the logic and flow of a neural network.
To run this project locally, you'll need Python and a few essential libraries:
- Python 3.x
numpymatplotlib(optional, for visualizing results)
-
Clone the repository:
git clone https://github.com/wojciechtrapkowski/digits_classifier cd neural-network-digits-classifier -
Install the required libraries:
pip install numpy matplotlib
- Run program:
python3 main.py
- Input Layer: 784 neurons (28x28 pixel input images).
- Hidden Layer: Configurable, but typically a layer with 30 neurons.
- Output Layer: 10 neurons (one for each digit 0-9).
- The network is trained using stochastic gradient descent with backpropagation.
- Activation function used: Sigmoid for neurons.
After training for several epochs, the model achieves approximately 95% accuracy on the MNIST test set.