Table of Contents
Neural networks are widely uses in imaxe acception tasks due to their ability to o learn complex patterns. This case study explores thee implementation process, including detailed calculations entrived in traing a neural network for image classification.
Designing te Neural Network
Te network consiss of an input layer, one hidden layer, and an output layer. For simpplicity, approder a small dataset with images represented by 4 pixels each. Te input layer has 4 neurons, thee hidden layer has 3 neurons, and the output layer has 2 neurons representing two classes.
Inicial Váhy a Biases
Váha are inicialized náhodný. For exampla, thee váhy mezi eein input and hidden layer are:
- W 'I1; FL1; FLT: 0' I3; 11 'I1; FL1; FLT: 1' II3; FL3; = 0, 2
- W 'I1; FL1; FLT: 0' I3; FL3; 12 'I1; FL1; FLT: 1' I3; FL3; = -0.3
- W 'I1; FL1; FLT: 0' I3; 13 'I1; FL1; FLT: 1' I3; FL3; = 0, 4
- W 'I1; FL1; FLT: 0' I3; FL3; 21 'I1; FL1; FLT: 1' I3; FL3; = -0.5
- W 'I1; FL1; FLT: 0' I3; FL3; 22 'I1; FL1; FLT: 1' I3; FL3; = 0, 1
- W 'I1; FL1; FLT: 0' I3; FL3; 23 'I1; FL1; FLT: 1' I3; FL3; = -0.2
- W 'I1; FL1; FLT: 0' I3; 31 'I1; FL1; FLT: 1' II3; FL3; = 0, 3
- W 'I1; FL1; FLT: 0' I3; 32 'I1; FL1; FLT: 1' I3; FL3; = -0.4
- W 'I1; FL1; FLT: 0' I3; 33 'I1; FL1; FLT: 1' I3; FL3; = 0, 2
Biases are set to zero inicality for simplicity.
Forward Propagation and Calculations
Given an input image with pixel values is curren1; 0.5, 0.2, 0.1, 0.7 curren3;, thee hidden layer inputs are calculated as:
H 'I1; FL1; FLT: 0' I3; FL3; 1 'I1; FLT: 1' I3; FL3; = (0, 5) (0, 2) + (0, 2) (- 0, 3) + (0, 1) (0, 4) = 0, 1 - 0, 06 + 0, 04 = 0, 08
H 'I1; FL1; FLT: 0' I3; FL3; 2 'I1; FLT: 1' I3; FLT: 1 'I3; FL3; = (0, 5) (- 0, 5) + (0, 2) (0, 1) + (- 0, 1) (- 0, 2) = - 0, 25 + 0, 02 - 0, 02 = - 0, 25
H 'I1; FL1; FLT: 0' I3; FL3; 3 'I1; FL1; FLT: 1' I3; FL3; = (0, 5) (0, 3) + (0, 2) (- 0, 4) + (0, 1) (0, 2) = 0, 15 - 0, 08 + 0, 02 = 0, 09
Appying an activation function, such as sigmoid, thee hidden layer outputs are:
O 'I1; FL1; FLT: 0' I3; 'I3; H1' I1; FL1; FLT: 1 'I3;' II3; = 1 / (1 + 'I1;' II1; 'FLT: 2' I3; 'I3; -008' I1; 'I1;' I1; 'FLT: 3' I3; 'II3;)
O 'I1; FLT: 0' I3; 'I3;' H2 'I1;' I1; 'FLT: 1'; 'II3;' II1; 'II1;' FLT: 0 ';' I3; 'II3;' I1; 'I1;' FLT: 3 'I3;' II3; 'II3;' III3; 'II1;' III1; 'IIII3;' I3; 'I33;' II1; 'I1;' I1; 'II1;' I1I1I1I3; 'II33
O 'I1; FL1; FLT: 0' I3; H3 'I1; FL1; FLT: 1' I3; FL3; = 1 / (1 + e 'I1; FLT: 2' I3; -0.09 'I1; FL1; FLT: 3' I3; 'II3;)
To je to, co se děje, když se to děje, když se to děje, když se to děje.
Calculating Error and Updating Weighs
Předpokladem je, že opravdu Class is class 1, represented as credi1; 1, 0 clarro3;. Te output laier computes:
O 'I1; CLANE1; FLT: 0' I3; CLANE3; CLANE3; CLANE3; CLANE3; = 1 / (1 + e 'I1; CLANE1; CLANE3; CLANE3; CLANE3; CLANE3; CLANE3; CLANE3; CLANE3; CLANE3; CLANE3; CLANE1; CLANE1; CLANE1; CLANE1; CLANE3; CLANE3;)
Where z CLAS1; CLAS1; FLT: 0 CLAS3; 1 CLAS1; CLAS1; FLT: 1 CLAS3; CLAS3; is the heasted sum of hidden outputs.
Loss = 0,5 * (CLASS - output) CLAS1; CLAS1; CLAS3; CLAS3; CLAS3; CLAS3; CLAS1; CLAS1; CLAS3; CLAS3;
Using gradient descent, headts are updated based on then error and learning rate, for exampla, 0.1.
Summary of Calculations
This processes opakovatelné for multipleepoch, settinging váhy to o improvizace preciacy. Detailed kalkulations involve e matrix multiplications, activation funktions, and error derivatives, which are essential for training neural networks effectively.