What is the use of the target matrix and how do i create one?

17 views (last 30 days)
We are developing a neural network for classification there are 72 signals and there are 100 samples of each signal. We have extracted 49 parameters from each signal. What should my target matrix contain

Accepted Answer

Greg Heath
Greg Heath on 25 Jan 2016
Edited: Greg Heath on 25 Jan 2016
The current neural network classification function is PATTERNNET (replacing the obsolete NEWPR). The syntax of the target matrix for N I-dimensional column inputs that are to be assigned into into 1 of c classes is N c-dimensional {0,1} unit vectors from the unit matrix eye(c).
[ I N ] = size(input)
[ c N ] = size(target)
The transformation between the true class index row vector and the corresponding target matrix is
target = full(ind2vec(trueclassind))
trueclassind = ind2vec(target)
Therefore, if the classifier output is
output = target+ randn(1,N)
the estimated classindex and error vectors are
estclassind = vec2ind(output)
error = estclassind~=trueclassind
Nerr = sum(error)
PctErr = 100*Nerr/N
1. Test the above code with N = 9,
classind = [ 9 7 5 3 1 8 6 4 2 ]
2. See the online documentation
help patternnet
doc patternnet
3. Search both the NEWSGROUP and ANSWERS for my examples
greg patternnet
Hope this helps.
Thank you for formally accepting my answer
Greg
  7 Comments
Image Analyst
Image Analyst on 30 Jan 2016
If it does, then please accept Professor Heath's answer to give him credit for helping you.
Aeri
Aeri on 30 Jan 2016
I would glad to, but I'm not the one who asked the questions, I only asked through the comments. I would just give a vote because its the least I can do, same with mr. Roberson.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 25 Jan 2016
Edited: Walter Roberson on 25 Jan 2016
It depends on which routine you are using. Typically the target matrix is a vector, one element per sample, which contains the nonnegative integer class number that the sample is to be assigned to. But for some routines, the target matrix is a 2D matrix, one row per sample, in which all of the elements in a row are 0 except that the N'th element is 1 to indicate that the sample belongs to the N'th class. (There are routines provided to convert between the two forms.)
You construct a target vector by populating it with the known class numbers for each of your training samples. You would have determined the known class numbers by some outside method. For example if those 72 signals are intended to be distinct, then the class number would be an integer in the range 1 to 72.

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!