rasmusbergpalm/DeepLearnToolbox

derivative of sigmoid at nnbp.m

GrifisJP opened this issue · 3 comments

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

In nnff.m, the sigmoid is already being calculated and stored in nn.a. Just need to do 1-sigm(x) in back propagation.

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 )

Well its clear now :)