My Neural Net Pattern recognition confusion matrix result is 96% but when I add new input the output of net show always same result. I didn't understand why .

1 Ansicht (letzte 30 Tage)
This is my code .
End of code I add an input and get prediction of my net .
But net gives always same result.
I have three option [0;0] , [1;0], [1;1]
I get always [1;0].
What's my fault ?
A=xlsread('data200.xlsx');
input=A(:,1:88);
target=A(:,89:90);
x=input';
t=target';
% Solve a Pattern Recognition Problem with a Neural Network
% Script generated by Neural Pattern Recognition app
% Created 07-Feb-2021 15:50:44
%
% This script assumes these variables are defined:
%
% x - input data.
% t - target data.
% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainscg'; % Scaled conjugate gradient backpropagation.
% Create a Pattern Recognition Network
hiddenLayerSize = [5,4,3];
net = patternnet(hiddenLayerSize, trainFcn);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
tind = vec2ind(t);
yind = vec2ind(y);
percentErrors = sum(tind ~= yind)/numel(tind);
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, ploterrhist(e)
%figure, plotconfusion(t,y)
%figure, plotroc(t,y)
a=stats1'; % a is my input data inside stats1 matrix
outputs = round(sim(net,a))
% I always get output result [1;0] even I load input which I know the result [0;0]
% but it still show the result [1;0]
  6 Kommentare
Ali Zulfikaroglu
Ali Zulfikaroglu am 31 Mär. 2021
By the way that 88 inputs looks much according to 200 datas.
So accuracy is not so good. How we can choose best inputs ? Maybe 10 of 88 will be better result.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Aditya Patil
Aditya Patil am 1 Apr. 2021
If neural network has issues with specific classes/outputs, then you should check if that specific class has very few samples in the dataset.
Also, wide datasets, where there are too many features, can be difficult to train on due to overfitting. Try reducing the number of features using dimensionality reduction techniques.
There could be other issues as well, like mislabelled data, the model being too large/small, etc. Try experimenting by changing one component at a time. For example, if some other model/algorithm works well on the data, you can rule out issues with data.

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by