I'm using Matlab Neural Network Toolbox. I want learn feed forward net for my classification problem. But network doesn't learn anything useful, so I start checking network setting.
I choose xor problem. I find that network doesn't learn xor if the output transfer function is set to logsig
(log-sigmoid function)! Sample code:
x = [0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1; 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
y =[0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0];
net = feedforwardnet([2 2]);
net = configure(net,x,y);
net.layers{3}.transferFcn = 'logsig'; %problem is here
[net,tr] = train(net,x,y);
net(x)
The output is: 0.5000 0.5000 0.9985 0.5000 0.5000 0.5000 0.9985 0.5000 0.5000 0.5000 0.9985 0.5000 0.5000 0.5000 0.9985 0.5000
I try few times and I never got any value smaller then 0.5. If I comment 6th line which set transfer function to logsig
the net learn perfect.
Does anyone know why network with logsig
doesn't work?
P.S My matlab version MATLAB 7.12.0 (R2011a).