首先,我们必须做一些简化。
1°
我们将只使用
in_Data
vector in_Data[N]
(在以下N=2的情况下)(如果我们仅在pat中成功,则不难将其扩展到矩阵中)。
2°
this blog
)
M=num_pattern
,但我们有以前的声明
in_data
作为向量,所以你可以
删除上面公式中的总和和下面公式中的矩阵
让我们编写代码:(我真的不懂MATLAB,所以我将编写一个伪代码)
vector d[num_connections+num_output_neurons] // num derivatives = num connections whitout count bias there are 8 connections. ; +2 derivative of O)
vector z[num_neurons] // z is the output of each neuron.
vector w[num_connections] // Yes a Vector! we have previous removed matrix and the sum.
// O layer
d[10] = (a[O1] - y[O1]); // Start from last to calculate the error.
d[9] = (a[O2] - y[O2]);
// H -> O layer
for i=5; i<=8; i++ ( Hidden to Out layer connections){
d[i] = (d)*g_prime(z[i])
}
// I -> H layer
for i=1; i<=8 i++ (Input to Hidden layer connections){
for j=1; i<=num_connection_from_neuron i++ (Take for example d[1] it depends on how many connections have H1 versus Outputs){
d[i] = d1 + (d[j+4]*w[j+4] )
}
d[i] = d[i]*g_prime(z[i]);
}
如果您需要在矩阵中扩展它,请在注释中编写它,我将扩展代码。
祝你好运,马可。