Artificial Neural Network - Training
Artificial Neural Network - Training
Credits:
Supervised learning
If the target output is not available, then the error in prediction can
not be determined and in such a situation, the system learns of its
own by discovering and adapting to structural features in the input
patterns.
Reinforced learning
Stochastic learning
Competitive learning
Note :
Based on the error signal, the neural network should modify its
configuration, which includes synaptic connections, that is , the
weight matrices.
E
Error, E
Initial weights
Adjusted
V, W W Best weight
weight
For simplicity, let us consider the connecting weights are the only
design parameter.
Let us consider any k-th neuron at the output layer. For an input
pattern It ∈ T (input in training), the target output tk of the k-th
neuron, computed output be yk .
∂E
∆V = −η (1)
∂V
and
∂E
∆W = −η (2)
∂W
Supervised learning : Back-propagation algorithm
∂E ∂E
Note that −ve sign is used to signify the fact that if ∂V (or ∂W )
> 0, then we have to decrease V and vice-versa.
Let vij (and wjk ) denotes the weights connecting i-th neuron (at the
input layer) to j-th neuron(at the hidden layer) and connecting j-th
neuron (at the hidden layer) to k-th neuron (at the output layer).
1 2
𝐸𝑘 = 𝑡 − 𝑦𝑘
2 𝑘
Activation Function
1 2
𝐸𝑘 = 𝑡 − 𝑦𝑘
2 𝑘
𝜕𝐸
Calculation of 𝜕𝑤 𝑘
𝑗𝑘
Calculation of w jk
yk
wjk yink f()
Ek
tk
Using Chain-Rule of differentiation
𝜕𝐸𝑘 𝜕𝐸 𝜕𝑦𝑘 𝜕𝑦𝑖𝑛𝑘
𝜕𝑤𝑗𝑘
= 𝜕𝑦𝑘 x 𝜕𝑦 x 𝜕𝑤𝑗𝑘
𝑘 𝑖𝑛𝑘
Calculation of w jk
yk
wjk yink f()
Ek
tk
𝜕𝐸𝑘 𝜕𝐸 𝜕𝑦𝑘 𝜕𝑦𝑖𝑛𝑘
= 𝜕𝑦𝑘 x 𝜕𝑦 x
𝜕𝑤𝑗𝑘 𝑘 𝑖𝑛𝑘 𝜕𝑤𝑗𝑘
1 2
𝐸𝑘 = 𝑡 − 𝑦𝑘
2 𝑘
𝜕𝐸𝑘
= −(𝑡𝑘 − 𝑦𝑘 )
𝜕𝑦𝑘
Calculation of w jk
yk
wjk yink f()
Ek
tk
𝜕𝐸𝑘 𝝏𝑬 𝜕𝑦𝑘 𝜕𝑦𝑖𝑛𝑘
= 𝝏𝒚𝒌 x 𝜕𝑦 x
𝜕𝑤𝑗𝑘 𝒌 𝑖𝑛𝑘 𝜕𝑤𝑗𝑘
1 2
𝐸𝑘 = 𝑡 − 𝑦𝑘
2 𝑘
𝝏𝑬𝒌
= −(𝑡𝑘 − 𝑦𝑘 )
𝝏𝒚𝒌
Calculation of w jk
𝝏𝒚𝒌
= 𝜆𝑦𝑘 (1 − 𝑦𝑘 )
𝝏𝒚𝒊𝒏𝒌
Calculation of w jk
−(𝑡𝑘 − 𝑦𝑘 ) 𝜆𝑦𝑘 1 − 𝑦𝑘 𝑧𝑗
−𝜆(𝑡𝑘 − 𝑦𝑘 ) 𝑦𝑘 1 − 𝑦𝑘 𝑧𝑗
𝜕𝐸 Let 𝜆 = 1
Δ𝑤𝑗𝑘 = − 𝜂 𝜕𝑤 𝑘 = 𝜂𝛿𝑘 𝑧𝑗
𝑗𝑘
Calculation of w jk
𝜕𝐸
Δ𝑤𝑗𝑘 = − 𝜂 𝜕𝑤 𝑘 = 𝜂𝛿𝑘 𝑧𝑗
𝑗𝑘
In matrix form: V W
m–n–p
Δ𝑊𝑛 𝑥 𝑝 = 𝜂𝑧𝑛 𝑥 1 𝛿1 𝑥 𝑝
zj yk
zinj f() yink f()
vij wjk Ek
tk
𝜕𝑦𝑖𝑛𝑘
= 𝑤𝑗𝑘
𝜕𝑧𝑗
Calculation of vij
1
𝑧𝑗 = 𝑓 𝑥 = 𝑓 ′ (𝑥) = 𝜆 𝑓 𝑥 (1 − 𝑓(𝑥))
1+ 𝑒 −𝜆𝑥
1
𝑧𝑗 = 𝑓 𝒛𝒊𝒏𝒋 = −𝜆𝒚𝒊𝒏𝒋
1+ 𝑒
𝝏𝒛𝒋
= 𝜆𝑧𝑗 (1 − 𝑧𝑗 )
𝝏𝒛𝒊𝒏𝒋
Calculation of vij
𝛿𝑖𝑛𝑗 𝑓 ′ (𝑧𝑖𝑛𝑗 )
𝛿𝑗
𝜕𝐸
Δ𝑣𝑖𝑗 = − 𝜂 𝜕𝑣 𝑘 = 𝜂𝛿𝑗 𝑥𝑖 Let 𝜆 = 1
𝑖𝑗
Calculation of vij
𝜕𝐸
Δ𝑣𝑖𝑗 = − 𝜂 𝜕𝑣 𝑘 = 𝜂𝛿𝑗 𝑥𝑖
𝑖𝑗
In matrix form: V W
m–n–p
Δ𝑉𝑚 𝑥 𝑛 = 𝜂𝑥𝑚 𝑥 1 𝛿1 𝑥 𝑛
1 0.4
x =
−0.7 2𝑥1
0 𝑤11 0.2
𝑊 = =
𝑤21 2𝑥1 −0.5 2𝑥1
Example
0
𝑧𝑖𝑛1
𝑧𝑖𝑛 = 𝑧 = 𝑉𝑇 x =
𝑖𝑛2 2𝑥1
𝑣11 𝑣21 𝑥1
=
𝑣12 𝑣22 𝑥2
0.1 −0.2 0.4 0.18
= =
0.4 0.2 2 𝑥 2 −0.7 2𝑥1 0.02 2𝑥1
Example
0
𝑧1
𝑧 = 𝑧
2 2𝑥1