- Ronith Salian
- Rajath D Shetty
This project demonstrates how Backpropagation works in three core deep learning models:
- 🔹 Artificial Neural Network (ANN)
- 🔹 Convolutional Neural Network (CNN)
- 🔹 Recurrent Neural Network (RNN)
All models are implemented from scratch using NumPy, focusing on clear understanding + step-by-step computation.
Input → Hidden Layer → Output
● -------- ● -------- ●
✔ Fully connected layers
✔ Learns non-linear relationships
Input → [3×3 Filter] → Feature → Output
⬛⬛⬛ ⬛⬛⬛
✔ Detects patterns (edges, shapes)
✔ Uses shared weights (kernels)
x₁ → [h] → x₂ → [h] → x₃ → [h]
✔ Maintains memory of previous inputs
✔ Processes sequences step-by-step
Backpropagation is used to minimize error by updating weights using gradients.
- Forward Pass → Compute output
- Loss Calculation → Measure error
- Backward Pass → Compute gradients
- Update Weights → Reduce error
Gradient: ∂L / ∂W = (∂L / ∂y) × (∂y / ∂W)
Error term: δ = (y_actual − y_predicted) × f'(z)
W_new = W_old − η × (∂L / ∂W) Where:
- η = Learning rate
- ∂L/∂W = Gradient
- Hidden layer with activation (tanh/sigmoid)
- Forward + Backward propagation
- Mean Squared Error (MSE)
Input → Hidden → Output
- Non-linear patterns
- Basic decision boundaries
- 3×3 convolution filter
- ReLU / Leaky ReLU activation
- Fully connected output layer
Output = Σ (Input × Kernel)
- Spatial features
- Patterns in input matrix
- Sequential input processing
- Hidden state (memory)
- Simplified Backpropagation Through Time (BPTT)
🔹 Hidden State Equation
h_t = tanh(x_tW_x + h_{t-1}W_h + b)
- Sequential patterns
- Time-dependent relationships
| Feature | ANN | CNN | RNN |
|---|---|---|---|
| Data Type | Tabular | Image | Sequence |
| Structure | Layers | Filters | Time steps |
| Memory | ❌ No | ❌ No | ✅ Yes |
| Weight Sharing | ❌ | ✅ | ✅ |
| Complexity | Low | Medium | High |
deep_learning_project/ │
├── ann.py # Artificial Neural Network
├── cnn.py # Convolutional Neural Network
├── rnn.py # Recurrent Neural Network
└── README.md
python ann.py
python cnn.py
python rnn.pyANN → Final Prediction: 0.98
CNN → Convolution Output: 3.66
RNN → Final Prediction: 0.92