I made a patternnet, and i cannot understand what target values mean

2 次查看(过去 30 天)
I have a set of image feature data and i have made my target matrix as:
targets = zeros(3,900);
targets(1,1:300) = 1;
targets(2,301:600) = 1;
targets(3,601:900) = 1;
what would change if i changed the 1 values as:
targets = zeros(3,900);
targets(1,1:300) = 1;
targets(2,301:600) = 2;
targets(3,601:900) = 1;
can anyone explain me what is their role?

回答(1 个)

Anshika Chaurasia
Anshika Chaurasia 2021-1-20
Hi Sougles,
In the following code, the dataset labels/target/classes are in one-hot encoding format.
targets = zeros(3,900);
targets(1,1:300) = 1;
targets(2,301:600) = 1;
targets(3,601:900) = 1;
Looking at the shape of targets, there are 3 classes in your dataset.
Let's say there are three classses A, B and C. So, we will need three binary variables for one-hot encoding. A "1" value is place in the binary variable for the class and "0" for the other classes.
Hence,
targets(1,1:300) = 1; % samples 1 to 300 belong to first class
targets(2,301:600) = 1;% samples 301 to 600 belong to second class
targets(3,601:900) = 1;% samples 601 to 900 belong to third class

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by