Effacer les filtres
Effacer les filtres

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

10 vues (au cours des 30 derniers jours)
Joana le 8 Mar 2020
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 commentaire
Srivardhan Gadila
Srivardhan Gadila le 11 Mar 2020
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?

Connectez-vous pour commenter.

Réponses (0)


En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by