derivative of sigmoid at nnbp.m
GrifisJP opened this issue · 3 comments
GrifisJP commented
I have a question in nnbp.m.
case 'sigm'
d{n} = - nn.e .* (nn.a{n} .* (1 - nn.a{n}));
and
case 'sigm'
d_act = nn.a{i} .* (1 - nn.a{i});
derivative of sigmoid is
sigmoid(x)/dx = sigmoid(x)*(1-sigmoid(x))
so.. shouldn'T it be like below?
case 'sigm'
d_act =sigm( nn.a{i}) .* (1 - sigm(nn.a{i}));
thank you
wajihullahbaig commented
In nnff.m, the sigmoid is already being calculated and stored in nn.a. Just need to do 1-sigm(x) in back propagation.
GrifisJP commented
Thank you.
I see, so this is why every iteration in training, nnff is also called before nnbp to update nn.a.
With Bishop notation in his book, nn.a is rewritten to ---> z = sigmoid( nn.a )
wajihullahbaig commented
Well its clear now :)