Contenido del Curso
Introduction to Neural Networks
Introduction to Neural Networks
Forward Propagation
Forward Propagation Process
Forward propagation is the process by which a neural network computes its output given an input. This is achieved by successively passing the input through all the layers of the network.
Each layer transforms its input data based on its weights, biases, and the activation function, producing an output. This output becomes the input to the next layer, and the process repeats until the final layer produces the network's output.
Here's a step-by-step breakdown for our perceptron:
-
Hidden Layer 1: The raw
inputs
are passed into the first hidden layer (layer1
), producinglayer1_outputs
; -
Hidden Layer 2: The outputs from the first hidden layer become inputs for the second hidden layer (
layer2
), resulting inlayer2_outputs
; -
Output Layer: Similarly, the outputs of the second hidden layer serve as inputs for the final output layer (
layer3
). The output of this layer is the output of the entire neural network.
Forward Propagation Testing
To test our forward propagation we will use XOR operation to see what outputs we get for it. XOR operation takes two binary inputs and returns False
(equals to 0) if the inputs are the same or True
(equals to 1) if they are different.
Here is the truth table with two inputs and the corresponding output for XOR:
Input 1 | Input 2 | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
We haven't trained our perceptron yet, so we don't expect it to give us correct answers. We just want to see that the input successfully passes through all the layers of the perceptron.
Note
You can try using XOR operation by yourself using
^
operator in python.
print('0 xor 0 =', 0 ^ 0) print('0 xor 1 =', 0 ^ 1) print('1 xor 0 =', 1 ^ 0) print('1 xor 1 =', 1 ^ 1)
Swipe to show code editor
Implement the forward propagation function for our perceptron:
- Pass the inputs through the first hidden layer.
- Pass the outputs of the first hidden layer through the second hidden layer.
- Pass the outputs of the second hidden layer through the output layer.
¡Gracias por tus comentarios!
Forward Propagation
Forward Propagation Process
Forward propagation is the process by which a neural network computes its output given an input. This is achieved by successively passing the input through all the layers of the network.
Each layer transforms its input data based on its weights, biases, and the activation function, producing an output. This output becomes the input to the next layer, and the process repeats until the final layer produces the network's output.
Here's a step-by-step breakdown for our perceptron:
-
Hidden Layer 1: The raw
inputs
are passed into the first hidden layer (layer1
), producinglayer1_outputs
; -
Hidden Layer 2: The outputs from the first hidden layer become inputs for the second hidden layer (
layer2
), resulting inlayer2_outputs
; -
Output Layer: Similarly, the outputs of the second hidden layer serve as inputs for the final output layer (
layer3
). The output of this layer is the output of the entire neural network.
Forward Propagation Testing
To test our forward propagation we will use XOR operation to see what outputs we get for it. XOR operation takes two binary inputs and returns False
(equals to 0) if the inputs are the same or True
(equals to 1) if they are different.
Here is the truth table with two inputs and the corresponding output for XOR:
Input 1 | Input 2 | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
We haven't trained our perceptron yet, so we don't expect it to give us correct answers. We just want to see that the input successfully passes through all the layers of the perceptron.
Note
You can try using XOR operation by yourself using
^
operator in python.
print('0 xor 0 =', 0 ^ 0) print('0 xor 1 =', 0 ^ 1) print('1 xor 0 =', 1 ^ 0) print('1 xor 1 =', 1 ^ 1)
Swipe to show code editor
Implement the forward propagation function for our perceptron:
- Pass the inputs through the first hidden layer.
- Pass the outputs of the first hidden layer through the second hidden layer.
- Pass the outputs of the second hidden layer through the output layer.
¡Gracias por tus comentarios!