Why does the Neural Network Pattern Recognition Tool GUI not list my workspace variable for target data in Neural Network Toolbox 7.0.3 (R2012a)?
14 views (last 30 days)
Show older comments
I have two workspace variables, a and b as follows
a=rand(10,200);
b=rand(1,200);
When I launch the NPRTOOL, I can see the workspace variables in "Inputs" but not for "Targets". I tried to import the variable as a MAT file but it still does not show up as a variable to select.
Accepted Answer
MathWorks Support Team
on 17 Jul 2012
The target variable for Neural Network Pattern Recognition Tool in Neural Network Toolbox 7.0.3 (R2012a) needs to be a matrix of ones or zeros indicating which class the corresponding input belongs to. For example, the variable could be as follows:
>> target_var=[ 1 0 0 0;
0 0 1 0;
0 1 0 1];
where first column represents class 1; second column means class 3, and so on.
In case you need to convert your already defined class matrix (one-
dimensional) to a matrix of appropriate ones and zeros, you can do it as follows:
>> ind = [1 3 2 3] ;
>> vec = ind2vec(ind) ;
>> target_var = full(vec)
ans =
1 0 0 0
0 0 1 0
0 1 0 1
which you can then use as variable for your "Targets".
You can also have a look at the variables which were used in the Example Data Sets. Please click "Load Example Data Set". The Pattern Recognition Data Set Chooser window opens. Choose a data set, for example. "Breast Cancer", and click Import. You can then view these variables in the workspace.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!