![]() |
VOOZH | about |
Forward propagation is the process where input data passes through each layer of a neural network to produce an output. It transforms raw inputs into predictions using weights, biases and activation functions.
1. Input Layer: Receives raw data where each feature corresponds to a neuron. Data is often normalized or standardized before processing.
2. Hidden Layers: The processed input passes through one or more hidden layers where most of the computation takes place. Each neuron performs a weighted sum of inputs and applies an activation function to capture non-linear patterns. The computation inside each neuron follows
where:
After this, an activation function such as ReLU or sigmoid is applied to produce the neuron’s output, which is then passed forward.
3. Output Layer: The final layer generates the model’s prediction. The choice of activation function depends on the task
4. Prediction: The network produces its final output using current weights and biases, which is then evaluated against the true value.
Consider a neural network with one input layer, two hidden layers and one output layer.
The transformation is:
where:
We can have n number of hidden layers:
where is the final output. Thus the complete equation for forward propagation is:
This equation illustrates how data flows through the network:
Here we will import Numpy and pandas library.
When initilaizing parameters Random initialization avoids symmetry issues where neurons learn the same function.
Here we will execute the process of forward propagation using the above functions we created.
Output:
Final Output:
[[0.40566303]
[0.39810287]
[0.41326819]]
Download full code from here