Neural Network Manual Propagation - Interactive Visual Guide

Neural Network Manual Propagation

Scenario: Developing a Recommendation Engine for Online Retail

Objective: Manual Forward and Backward Pass Implementation

Process Flowchart & Implementation Steps

1
Library Import & Setup
Import NumPy and Matplotlib for mathematical operations and visualisation capabilities.
import numpy as np
import matplotlib.pyplot as plt
2
Network Architecture Definition
Create a neural network with input dimension of 2, one hidden layer (2 neurons), and one output layer.
Hidden Layer Weights: [[0.2, 0.9], [0.6, 0.6]]
Hidden Layer Biases: [0.8, 0.9]
Output Layer Weights: [[0.9], [0.4]]
Output Layer Biases: [0.9]
3
Input Data Configuration
Define input data X with two elements: 0.3 and 0.4 representing customer features.
X = np.array([[0.3, 0.4]])
4
Activation Functions
Define ReLU and Sigmoid activation functions with their derivatives for gradient computation.
ReLU: max(0, x)
Sigmoid: 1 / (1 + exp(-x))
5
Forward Propagation
Compute forward pass through hidden and output layers to generate predictions.
Hidden Input → ReLU → Output Input → Sigmoid → Final Prediction
6
Loss Computation
Calculate loss derivative with respect to final output using target value of 1.
target = 1
loss_derivative = final_output - target
7
Backward Propagation
Perform backward pass through output and hidden layers to compute gradients.
Output Gradients → Hidden Gradients → Weight Updates
8
Gradient Descent Optimisation
Update weights and biases using gradient descent with learning rate of 0.02.
learning_rate = 0.02
weights -= learning_rate * gradients

Neural Network Architecture Visualisation

Input Layer
(Customer Features)
0.3
0.4
Hidden Layer
(ReLU Activation)
H₁
H₂
Output Layer
(Sigmoid Activation)
Y

Network Configuration Summary

Input Dimensions: 2 features | Hidden Layer: 2 neurons with ReLU | Output: 1 neuron with Sigmoid | Target: Binary classification (0 or 1)

Key Findings & Conclusions

Forward Pass Results

Successfully computed predictions through the network layers, demonstrating how input features are transformed into final recommendations.

Gradient Computation

Manual backpropagation revealed how gradients flow through the network, enabling precise weight adjustments for improved accuracy.

Learning Process

Gradient descent with learning rate 0.02 effectively updated network parameters, demonstrating the fundamental learning mechanism.

Activation Functions

ReLU activation in hidden layers and Sigmoid in output layer proved effective for this binary classification task.

Mathematical Foundation

Manual implementation provided deep understanding of matrix operations, derivatives, and optimisation principles underlying neural networks.

Network Architecture

The 2-2-1 architecture (input-hidden-output) successfully processed customer features for recommendation predictions.

Business Implications & Recommendations

Enhanced Customer Experience

The recommendation engine will provide personalised product suggestions, increasing customer satisfaction and engagement on the retail platform.

Revenue Growth Potential

Improved recommendation accuracy leads to higher conversion rates, increased average order value, and enhanced customer lifetime value.

Scalability Considerations

The manual implementation understanding enables better architecture decisions for scaling to millions of customers and products.

Competitive Advantage

Deep learning-powered recommendations provide a significant edge over traditional rule-based systems in the online retail market.

Implementation Strategy

Start with this foundation and gradually expand to more complex architectures with additional layers and advanced optimisation techniques.

Performance Monitoring

Establish metrics for recommendation accuracy, click-through rates, and conversion rates to continuously optimise the system.

Project Impact & Next Steps

🎯 Strategic Value Delivered

This manual implementation establishes the foundation for a sophisticated recommendation engine that will transform customer experience and drive significant revenue growth in the competitive online retail landscape.