MATLAB: Neural Network program problem in classification

classificationconfusionDeep Learning Toolboxneural networkperformance

Hi All
I am using this code to train my network, the problem is , if I give an input that is somehow among the value of the inputs I have chosen to train , it gives the right output , but if I give something out of this range , still the output is in the same range of the targets I have given to the code :
close all, clear all, clc, plt = 0
load('input.txt')
%load input
load ('target.txt')
%normalizing data
input=input';
target=target';
% input = mapstd(input);
% target = mapstd(target);
x=input;
t=target;
% [ x, t ] = simpleclass_dataset;
[ I N ] = size(x) % [ 2 1000 ]
[ O N ] = size(t) % [ 4 1000 ]
%vec2ind Transform vectors to indices. takes an NxM matrix V and returns a 1xM vector of indices
% indicating the position of the largest element in each column of V.
trueclass = vec2ind(t);
class1 = find(trueclass==1);
class2 = find(trueclass==2); %in my example all the largest elements are on the 2nd column
class3 = find(trueclass==3);
class4 = find(trueclass==4);
N1 = length(class1)
N2 = length(class2)
N3 = length(class3)
N4 = length(class4)
x1 = x(:,class1);
x2 = x(:,class2);
x3 = x(:,class3);
x4 = x(:,class4);
plt = plt + 1
hold on
plot(x1(1,:),x1(2,:),'ko')
plot(x2(1,:),x2(2,:),'bo')
plot(x3(1,:),x3(2,:),'ro')
plot(x4(1,:),x4(2,:),'go')
%
% Nw = (I+1)*H+(H+1)*O;
Hub = -1+ceil( (0.7*N*O-O)/(I+O+1)) % 399
Hmax = 40 % Hmax << Hub
dH = 4 % Design ~10 candidate nets
Hmin = 2 % I know 0 and 1 are too small
rng(0) % Allows duplicating the rsults
j=0
for h=Hmin:dH:Hmax
j = j+1
net = patternnet(10);
net = init(net); % Improving Results since we use patternet we should use init
[ net tr y ] = train( net, x, t );
assignedclass = vec2ind(y);
err = assignedclass~=trueclass;
Nerr = sum(err);
PctErr(j,1) = 100*Nerr/N;
end
h = (Hmin:dH:Hmax)'
PctErr = PctErr
I just want to know , according to the graphs of confusion , performance ,and the classes drawn , is the training enough or too much or little ?

Best Answer

You are confused.
What is the physical problem you are trying to solve?
1. What are the inputs?
2. What are the corresponding outputs?
3. The targets are not unit vectors. Therefore they are not appropriate for use in a standard NN classifier.