Multilayer neural network only slightly better than linear neural network
1 次查看(过去 30 天)
显示 更早的评论
I have made a linear neural network with a hidden layer and a multilayer non-linear neural network with 3 hidden layers. Both of them get as input a matrix of this kind:
1.7300 1.9500 2.3800 1.4400 5.0000 4.7500 2.1000 3.2000 2.2500 1.3000
3.4000 3.2000 3.3000 3.7500 3.5000 3.4000 3.2000 3.4000 3.2500 5.2500
5.0000 3.0000 2.0000 7.0000 1.0000 1.0000 3.0000 2.0000 2.0000 9.0000
and have this kind of matrix as target:
0 0 0 1 0 0 0 0 1 1
1 1 0 0 0 1 1 0 0 0
0 0 1 0 1 0 0 1 0 0
The code for the first neural network is the following
function [trainClassificationRatio, testClassificationRatio] = feedForwardLinearNet(xTrain,tTrain, xTest,tTest)
rng ('default');
net = feedforwardnet(3);
net.layers{1}.transferFcn = 'purelin';
[net, tr, Ytrain] = train(net,xTrain,tTrain);
trueTrainClass = vec2ind(tTrain);
assignedTrainClass = vec2ind(Ytrain);
trainError = assignedTrainClass ~= trueTrainClass;
trainNumError = sum(trainError);
trainPctError = 100 * trainNumError / size(xTrain,2);
trainClassificationRatio = 100 - trainPctError;
Ytest = net(xTest);
trueTestClass = vec2ind(tTest);
assignedTestClass = vec2ind(Ytest);
testError = assignedTestClass ~= trueTestClass;
testNumError = sum(testError);
testPctError = 100 * testNumError / size(xTest,2);
testClassificationRatio = 100 - testPctError;
end
The code for the second non-linear multilayer neural network differs from the first only in this part:
net = feedforwardnet([6 6 6]);
net.layers{3}.transferFcn = 'softmax';
I have also used patternnet either with the default settings or with setting the output transfer function to logsig with no improvement. Why the accuracy of the 2 different NN's is almost the same?
1 个评论
Aditya Patil
2020-9-22
Neural network accuracy can be affected by many factors. Can you elaborate more on what the accuracies are currently, so that better suggestions could be provided? Also, any information on the data size and features would be helpful.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!