how to store target into array bpnn?
1 view (last 30 days)
Show older comments
if true
% code
endhi, i'm working on project of classification images. i have 4 classes. the dataset of the training in the last column is the class label where 4 class. 1-4.
how to write a code to store the target into array. i want to make if the target is 4, it will store 1000. my code below did not work.
loadinput = dlmread('Train.csv');<
x = loadinput;
tempt = loadinput;
x(:,2501)=[];
noofInputSet = length(x(:,1));
disp(noofInputSet);
noofInputNode = length(x(1,:));
noofHiddenNode = noofInputNode / 2;
noofInputBiasNode = 1;
noofHiddenBiasNode = 1;
noofOutputNode = 4;
for r=1:noofInputNode
tempt(:,1)=[];
%store target into array t
for sT=1:noofInputSet
if tempt(sT)==1,
t(sT) =1000;
elseif tempt(sT)==2,
t(sT) = 0100;
elseif tempt(sT)==3,
t(sT)=0010;
elseif tempt (sT)==4,
t(sT)=0001;
end
-can somebody help me fix this
0 Comments
Answers (1)
Greg Heath
on 15 Jun 2016
TARGET VECTORS SHOULD BE COLUMNS OF THE UNIT MATRIX eye(4)
classindices = [ 1 2 3 4 3 2 1]
target = full(ind2vec(classindices))
classindices = vec2ind(target)
Hope this helps.
Thank you for formally accepting my answer
Greg
2 Comments
See Also
Categories
Find more on Recognition, Object Detection, and Semantic Segmentation 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!