https://github.com/sankhya007/demo_neural
https://github.com/sankhya007/demo_neural
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/sankhya007/demo_neural
- Owner: sankhya007
- Created: 2025-10-29T16:49:19.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-10-29T17:05:46.000Z (8 months ago)
- Last Synced: 2025-10-29T19:08:02.955Z (8 months ago)
- Language: Python
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🧠 Neural Network from Scratch (Pure Python Implementation)
A fully functional **neural network built from scratch in Python**, without relying on deep learning frameworks like TensorFlow or PyTorch.
This project demonstrates the **core mechanics** behind neural networks — from forward propagation to backpropagation and gradient descent — with clean, modular, and well-documented code.
## 🚀 Features
✅ **Custom Neural Network Class** – Pure Python + NumPy implementation
✅ **Multiple Activation Functions** – ReLU, Sigmoid, and Tanh
✅ **Configurable Architecture** – Define any number of layers and neurons
✅ **Supports Both Tasks** – Classification & Regression
✅ **Mini-Batch Gradient Descent** – Efficient training
✅ **Real-Time Training Visualization** – Loss and accuracy plots
✅ **Comprehensive Evaluation Metrics** – Accuracy, MSE, and R² score
## 🧩 Project Structure
```
neural_network_demo/
├── neural_network.py # Core neural network implementation (classification)
├── main.py # Demo for classification and regression
├── requirements.txt # Dependencies
├── run.bat # Run script for Windows
├── run.sh # Run script for Linux/Mac
├── README.md # Project documentation
└── .gitignore # Ignore unnecessary files
```
## ⚙️ Installation
1️⃣ Clone the repository:
```bash
git clone https://github.com/sankhya007/demo_neural.git
cd demo_neural
```
2️⃣ Install dependencies:
```bash
pip install -r requirements.txt
```
## ▶️ Usage
Run the demo:
```bash
python main.py
```
You’ll see:
- Training progress with live updates every 100 epochs
- Real-time loss and accuracy visualization
- Final evaluation metrics for both classification and regression tasks
## 📊 Results
- Achieves **~78% accuracy** on multi-class classification datasets
- Smooth convergence curves for both **loss** and **accuracy**
- Regression model yields strong **R² performance** and low **MSE**
## 🧠 Concepts Covered
- Forward Propagation
- Backpropagation
- Activation Functions (ReLU, Sigmoid, Tanh)
- Softmax Output for Multi-Class Problems
- Mini-Batch Gradient Descent
- Loss Functions (Cross-Entropy & MSE)
- Model Evaluation Metrics
## 📈 Example Visualizations
- **Classification:** Loss & Accuracy curves over epochs
- **Regression:** Predicted vs Actual scatter plot with R² score
- **Training Diagnostics:** Validation loss tracking
## 💡 Future Improvements
- Add dropout and batch normalization
- Implement momentum and Adam optimizers
- Save and load trained model weights
- Extend to support convolutional layers
## 🧑💻 Author
**Sankhyapriyo Dey**
📧 [GitHub Profile](https://github.com/sankhya007)
## 🪪 License
This project is released under the **MIT License** – free to use and modify.