Adding hidden layers to a patternnet hurts accuracy?

10 ビュー (過去 30 日間)
Ekaterina Kryuchkova
Ekaterina Kryuchkova 2019 年 4 月 3 日
編集済み: Greg Heath 2019 年 4 月 4 日
I am trying to use patternnet to classify the MNIST handwritten digit dataset.
I expected patternnet(10) to do worse than patternnet([10,10]), but it seems that the accuracy decreases as I add more layers.
Can someone explain why?
Here is my code:
images = loadMNISTImages('train-images.idx3-ubyte'); % initialize figure
labels = loadMNISTLabels('train-labels.idx1-ubyte'); % initialize figure
labels = labels'; % transpose
labels(labels==0)=10; % dummyvar function doesn´t take zeroes
labels=dummyvar(labels)';
net = patternnet([10,10]); %or patternnet(10)
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.performFcn = 'crossentropy';
net = configure(net,images,labels);
net = train(net,images,labels);
y=net(images);
perf = perform(net,labels,y)
correctcount=0;
for i = 1:60000
[M, I]= max(y(:,i));
if t(I,i)== 1
correctcount=correctcount+1;
end
end
errorrate = 1- (correctcount/60000)

採用された回答

Greg Heath
Greg Heath 2019 年 4 月 3 日
編集済み: Greg Heath 2019 年 4 月 4 日
  1. The global minimum is achievable with a single hidden layer.
  2. With more hidden layers you add more local minima; most of which are higher than the global minimum.
Thank you for formally accepting my answer
Greg

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeClassification についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by