Skip to content

Commit e2e08ae

Browse files
committed
bug in mlp fixed
1 parent ef29e56 commit e2e08ae

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

mlp.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
end
221221

222222
if l == n_layers && M.output.binary
223-
h0{l} = sigmoid(h0{l});
223+
h0{l} = softmax(h0{l});
224224
end
225225
end
226226

mlp_classify.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
end
4949

5050
if l == n_layers && M.output.binary
51-
posterior = sigmoid(posterior);
51+
posterior = softmax(posterior);
5252
end
5353
end
5454
else
@@ -64,7 +64,7 @@
6464
end
6565

6666
if l == n_layers && M.output.binary
67-
posterior = sigmoid(posterior);
67+
posterior = softmax(posterior);
6868
end
6969
end
7070
end

softmax.m

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
% simple wrapper for softmax function
2+
function [y] = softmax(x)
3+
4+
logZ = logsum(x, 2);
5+
y = exp(bsxfun(@minus, x, logZ));
6+
7+

0 commit comments

Comments
 (0)