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

2 views (last 30 days)
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?

Answers (1)

Anshika Chaurasia
Anshika Chaurasia on 20 Jan 2021
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

Categories

Find more on Deep Learning Toolbox 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!