This repository contains a basic implementation of a neural network trained on the MNIST dataset using Python and Numpy (without TensorFlow).
The MNIST dataset is a classic benchmark dataset in the field of machine learning and computer vision. It consists of 28x28 grayscale images of handwritten digits (0-9). The task is to classify these images into their respective digit classes. In this implementation, a simple feedforward neural network is used to classify the images. The architecture of the neural network is as follows:
- Input layer: 784 neurons (28x28 pixels flattened)
- Hidden layer: 10 neurons with ReLU activation
- Output layer: 10 neurons with softmax activation (corresponding to the 10 digit classes)
- Python 3.x
- Numpy 1.26.4
- Pandas 2.2.0
pip3 install -r requirements.txt
- Clone this repository:
git clone https://github.com/Yash2402/neural-network.git
- Navigate to the project directory:
cd neural-network
Note: After cloning repository, download MNIST Dataset Mnist Dataset, unzip it and then store the data/
folder in neural-network/
folder.
- Run the
train.py
script to train the neural network:
python3 train.py [max_iterations] [learning_rate] # max_iterations = 3000 and learning_rate = 0.5 works great for me
- Test the Neural Network
python3 test.py
Note: To see the next prediction close the matplotlib window
This project is licensed under the MIT License. See the LICENSE file for details.
This implementation is based on tutorials and resources from Youtube Channels like 3Blue1Brown, Samson Zhang and other online sources. Feel free to contribute or provide feedback to improve this implementation!