A minimal project to understand the fundamentals behind neural networks.
This repository contains a small educational project where a neural network is built entirely from scratch using only NumPy.
The goal of the project is not to achieve state-of-the-art accuracy, but to understand:
- How forward propagation works
- How backward propagation (gradients) are computed
- How weights and biases are updated through gradient descent
- How a simple network can learn to recognize handwritten digits
This project is ideal for beginners who want to see how neural networks actually work under the hood — without relying on libraries such as TensorFlow or PyTorch.
The model includes:
- 784 input nodes (28×28 pixels)
- 1 hidden layer (ReLU)
- 10 output nodes (softmax)
- Manual forward propagation
- Manual backward propagation
- Gradient descent training
No machine learning libraries are used — only NumPy.
The mnist_to_csv.py script downloads MNIST using sklearn, normalizes it, and stores the images and labels inside data/train.csv and data/test.csv.
Inside the notebook you can:
- Visualize digits
- Compare predictions vs. labels
- Inspect accuracy
- Test random samples
Follow these steps to run the project on your own machine.
pip install -r requirements.txt in the vscode terminal
If you do not already have train.csv and test.csv, run:
python mnist_to_csv.py in the vscode terminal
This will download MNIST and save the dataset into the data/ folder.
Inside the notebook you can:
- Train the neural network
- Visualize loss/accuracy
- Test individual digits
- Run predictions
- Load or save model weights