From 4eb3b34ef0f49223d88c94247964bdbf5cd12d1f Mon Sep 17 00:00:00 2001 From: Kaushal Reddy <84959787+kaushalrog@users.noreply.github.com> Date: Tue, 24 Feb 2026 10:33:33 +0530 Subject: [PATCH] Update README.md --- README.md | 137 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 99 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 65c3265..e5ceef5 100644 --- a/README.md +++ b/README.md @@ -1,67 +1,128 @@ -# Handwritten Digit Recognition from Scratch +# Digit Recognition using Neural Network (From Scratch) -A neural network built from **scratch using pure Python** to recognize MNIST handwritten digits with **95-97% accuracy** — no NumPy, TensorFlow, or PyTorch! +A Python implementation of a handwritten digit recognition system built entirely from scratch. This project focuses on understanding the mathematical foundations of neural networks without relying on high-level deep learning frameworks. -## 🎯 Features +The goal is educational clarity, architectural transparency, and strong fundamentals in machine learning implementation. -- ✅ Pure Python implementation (no ML libraries) -- ✅ Custom matrix operations from scratch -- ✅ Forward & backward propagation -- ✅ Mini-batch gradient descent -- ✅ 95-97% test accuracy on MNIST +--- + +## Project Overview + +This repository implements a fully connected neural network to classify handwritten digits from the MNIST dataset. All core components such as forward propagation, backpropagation, weight updates, and data handling are manually implemented. + +This project demonstrates: + +* Manual neural network implementation +* Matrix-based forward and backward propagation +* Gradient descent optimization +* Dataset handling and preprocessing +* Modular and readable Python structure + +--- + +## Project Structure -## 🏗️ Architecture ``` -Input (784) → Hidden (128, ReLU) → Output (10, Softmax) +digitrecognition/ +│ +├── data_loader.py # Loads and preprocesses dataset +├── download_mnist.py # Downloads MNIST dataset +├── find_data.py # Utility to locate dataset files +├── my_math.py # Custom mathematical helper functions +├── neural_network_scratch.py # Core neural network implementation +├── show_structure.py # Displays model architecture details +├── train.py # Training script +├── test_single.py # Test prediction for a single sample +├── README.md +└── .gitignore ``` -## 🚀 Quick Start +--- + +## Technologies Used + +* **Language:** Python +* **Numerical Computation:** NumPy +* **Dataset:** MNIST + +No high-level ML frameworks such as TensorFlow or PyTorch are used. All learning logic is implemented manually. + +--- + +## How It Works + +1. MNIST dataset is downloaded and prepared. +2. Data is normalized and structured for training. +3. A feedforward neural network performs prediction. +4. Backpropagation computes gradients. +5. Weights are updated using gradient descent. + +--- + +## Setup Instructions + +### 1. Clone the Repository + ```bash -# Clone repository git clone https://github.com/kaushalrog/digitrecognition.git cd digitrecognition +``` + +### 2. Install Dependencies + +```bash +pip install numpy +``` -# Install matplotlib (only dependency) -pip install matplotlib +### 3. Download Dataset -# Download MNIST data +```bash python download_mnist.py +``` + +### 4. Train the Model -# Train model +```bash python train.py ``` -## 📊 Results +### 5. Test a Single Sample -- **Training Accuracy**: ~96-98% -- **Test Accuracy**: ~95-97% -- **Training Time**: ~5-10 minutes (20 epochs) +```bash +python test_single.py +``` -## 📁 Files +--- -- `my_math.py` - Custom matrix operations -- `data_loader.py` - MNIST loader -- `neural_network_scratch.py` - Neural network -- `train.py` - Training script +## Learning Objectives -## 🧠 What's Inside +This project is ideal for understanding: -Built from scratch: -- Matrix class with all operations -- ReLU & Softmax activations -- Cross-entropy loss -- Backpropagation algorithm -- He weight initialization -- Mini-batch gradient descent +* Neural network internals +* Backpropagation mathematics +* Gradient descent optimization +* Matrix operations in ML +* Building ML systems without frameworks -## 👨‍💻 Author +--- -**Kaushal** - [GitHub](https://github.com/kaushalrog) +## Future Improvements -## 📝 License +* Add configurable hyperparameters +* Implement mini-batch gradient descent +* Add performance metrics visualization +* Export trained model weights +* Build a simple web interface for predictions -MIT License +--- + +## License + +This project is licensed under the MIT License. --- -⭐ Star if you found this helpful! +## Author + +Kaushal S +GitHub: h