Analytical Example
Single-Layer Network with Sigmoid Activation Function
Let’s consider the simplest case of a neural network, consisting of a single output neuron and several inputs, to analytically derive the weight update formula.
Network Structure:
- Input layer with neurons. Input vector: .
- Output layer with one neuron .
- Weights connecting the inputs to the output neuron: .
- Bias for the output neuron: .
Activation Function: As the non-linear activation function , we will choose the logistic function (sigmoid):
Its derivative, which will be needed for the backward pass, has a simple expression in terms of the function itself:
Forward Pass:
-
Induced Local Field (Weighted Sum of Inputs):
-
Neuron Output Signal: The output is obtained by applying the sigmoid activation function:
-
Output Error: The error is calculated as the difference between the desired output and the actual output :
Backward Pass and Explicit Weight Update Formula:
-
Local Gradient (): For an output neuron, the local gradient is the product of the error and the derivative of the activation function:
Since , we can substitute the expression for the derivative of the sigmoid:
-
Weight Change (): The correction for each weight is calculated using the “delta rule”:
where is the learning rate.
-
Explicit Expression for the Updated Weight: By substituting the expression for into the update formula, we get the final analytical expression for the new weight value:
-
Bias Update (): The bias is updated similarly (the input for the bias is
+1):
Thus, we have obtained explicit formulas for updating all trainable parameters of the network by analytically calculating the gradient for a specific activation function.