ANN_Model_Calculation_Example_ascii
ANN_Model_Calculation_Example_ascii
Let's work through the mathematics of a simple Artificial Neural Network (ANN) on a very small
We will go through a single-layer neural network with 1 hidden layer, using one of the most popular
Consider the following dataset with 5 data points, each with 2 features, and a binary target variable:
|0 |0 |0 |
|0 |1 |1 |
|1 |0 |1 |
|1 |1 |0 |
| 0.5 | 0.5 |1 |
1. 2 inputs.
W1 = [[0.1, -0.2],
[0.4, 0.3]]
b1 = [0.0, 0.1]
3. Output Layer Weights W2: a 2x1 matrix for weights from the hidden layer to the output neuron.
W2 = [0.3,
-0.4]
b2 = -0.1
We will go through the forward pass for the first data point, (0, 0) with target y = 0.
z1 = x . W1 + b1
z2 = a1 . W2 + b2
With target y = 0:
We would continue by calculating the gradients of this loss with respect to each weight and bias,