Skip to content

Commit 6133e2f

Browse files
committed
Update nnbp.m
added rectified linear and softplus activation functions
1 parent c083531 commit 6133e2f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

NN/nnbp.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
d_act = nn.a{i} .* (1 - nn.a{i});
1818
case 'tanh_opt'
1919
d_act = 1.7159 * 2/3 * (1 - 1/(1.7159)^2 * nn.a{i}.^2);
20+
case 'relu'
21+
d_act = nn.a{i};
22+
d_act(find(d_act>0))=1; d_act(find(d_act<=0))=0;
23+
case 'softp'
24+
d_act = 1./(1+exp(-nn.a{i}));
2025
end
2126

2227
if(nn.nonSparsityPenalty>0)

0 commit comments

Comments
 (0)