How can I test a trained Neural Network Model on new test data?

조회 수: 2 (최근 30일)
Joana 2020년 3월 8일
댓글: Srivardhan Gadila 2020년 3월 11일
I am trying to test a trined NN model in MATLAB but it's giving the wrong output. I have trained the model on input of order 223x448 with labels as 223x1. And tested on the another set of order 114x448. where 114 comprises of two classes,each of the 57 labels for class 1 and clas 2. When i test the model it classify each class as one class; class 1 or class 2; and gives the confusion matrix of [57 57 ; 0 0]. Can anyone please help where i am doing this wrong.
The code to train the model:
trainFcn = 'trainscg'; % Scaled conjugate gradient backpropagation.
hiddenLayerSize = [10 10 10];
net = patternnet(hiddenLayerSize, trainFcn);
net.input.processFcns = {'removeconstantrows','mapminmax'};
net.performFcn = 'crossentropy'; % Cross-Entropy
net.plotFcns = {'plotconfusion'};
[net,tr] = train(net,train_f,train_L);
ANd this is how i test:
y = net(test_f);
e = gsubtract(test_L,y);
performance = perform(net,test_L,y);
tind = vec2ind(test_L);
yind = vec2ind(y);
percentErrors = sum(tind ~= yind)/numel(tind);
% Testing accuracy
fprintf('\n Classification Accuracy (NN): %g %%',accuracy);
figure, plotconfusion(test_L,y)
Any help will be highly appreciated.
  댓글 수: 1
Srivardhan Gadila
Srivardhan Gadila 2020년 3월 11일
In 223 training samples what is the count w.r.t class 1 and class 2?
Also can you check the confusion matrix on the training set after training the network?

댓글을 달려면 로그인하십시오.

답변 (0개)


Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by