Matlab神经网络:tansig总是返回正值

时间:2014-04-28 16:31:04

标签: matlab neural-network classification

我正在进行分类任务,但面临的问题是,当我在经过训练的网络上运行模式时,我只得到+ ve分类(相当于logsig always > 0.5),而我希望tansig应该返回 - 当我将经过训练的网络应用于原始模式(下面的最后一行代码)时,经常会看到值。

所有归一化都由内置函数自动进行,结果如下所示。

summary of my results

么?

[patterns,targets] = getData();
patterns = patterns';  % 11x3078
targets = targets';    %  1x3078

learner = 'trainlm'; % 'trainlm', 'trainbr', 'trainscg'
hiddenSizes = 5;  % default is 10
net = feedforwardnet(hiddenSizes, learner);

% inps = net.inputs{1}.processFcns;
% default for hidden layers is 'tansig'
net.layers{1}.transferFcn = 'tansig';
% default for hidden layers is 'purelin'
% tansig is preferred over a linear function for classification
net.layers{2}.transferFcn = 'tansig';

net.divideParam.trainRatio = 0.7;
net.divideParam.valRatio = 1 - net.divideParam.trainRatio;
net.divideParam.testRatio = 0.0;

[net, tr] = train(net, patterns, targets);   % train the networks

%% Test the Network
outputs = net(patterns);

0 个答案:

没有答案