how to store target into array bpnn?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Greg Heath
2016 年 6 月 15 日
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 件のコメント
Greg Heath
2016 年 6 月 16 日
You probably won't get any help until you correctly format your code.
Greg
参考
カテゴリ
Help Center および File Exchange で Recognition, Object Detection, and Semantic Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!