How to determine input and target data for classification in neural network

Hi,
I'm working on gait recognition problem, the aim of this study is to be used for user authentication (i.e. authenticate the authorised user of a mobile device and reject the imposters)
I have data of 36 users
I've successfully extracted features which are (36 rows and 143 columns) for each user and store it in a matrix called All_Feat.
(by the way, column represents the number of the extracted features and row represents the number of samples for each feature).
Then, for each user, I divided the matrix (All_Feat) into two matrixes ( Training matrix, and Test matrix ).
The training matrix contains ( 25 rows and 143 columns) while the testing matrix has (11 rows and 143 columns).
In order to differentiate between User1 and the remaining 35 users, User 2 and remaining 35 users, and so on ..... , I'd like to use Neural Network.
Based on what I have read, training Neural Network requires two classes, the first class contains all the training data of genuine user (e.g. User1) and labelled with 1 , while the second class has the training data of imposters labelled as 0 (which is binary classification, 1 for the authorised user and 0 for imposters).
now my question is:
1- i dont know how to create these classes!
2- For example, if I want to train Neural Network for User1, I have these variables, input and target. what should I assign to these variables? should input= Training matrix of User1? Target=Training matrix of all the remaining Users (35 Users)?
I really appreciate any help!

 Accepted Answer

input should be the features for all of the samples.
target should be 0 for the samples with the genuine user, and 1 for the samples for imposters.
However, for some kinds of neural network, instead target should be [1 0] for the samples for the genuine user, and [0 1] for the samples for imposters.

13 Comments

Dear Walter, many thanks for your help!
from you answer,
For example, if I want to train the neural network for user1,
I should create a new matrix that contains all the whole samples of User1 (which are 36 rows (samples) and 143 columns (features)). Moreover, the i mposter's samples should be added to that matrix as well.
Finally, the resulted Matrix should be assigned into input (is that right?)
2- to create the target matrix of User1, the first 143 columns are 1 (which is an indication that the first 143 columns in the Input matrix comes from User1) , while the remaining columns are 0 (which is an indication the remaining columns in the Input matrix comes from Imposters).
please let me know if this correct. many thanks for your support
Thank you so much dear Walter, you are really kind. I'm going to post my code in order to show you the step and see if i miss something!
is that ok please?
Regards.
You could post it, but gait recognition is not something I have studied. There have been a number of posts about gait recognition that tend to get fairly involved.
Dear Walter Roberson, really appreciate your help.
Just have a question regarding of the Target matrix. Based on your example, suppose I have 14 training samples for User1 and 144 samples training samples for imposters (Non-User1).
Hence, I guess the Target Matrix of User2 will look like this ( in the first row, (14 times 1) and 144 times zero, and the second row will be ( 14 times zero) and 144 times 1 ) is that right?
[ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 ........................0 ; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ............... ..1]
sorry again to bother you, but which one is correct because you have mentioned in your previous comment
target should be 0 for the samples with the genuine user, and 1 for the samples for imposters.
However, for some kinds of neural network, instead target should be [1 0] for the samples for the genuine user, and [0 1] for the samples for imposters
when i used the first approach the result is very very very bad with equal error rate about 50 % !
while the second approach was ok! how can i know which one is correct?
You have not indicated which neural network command you are using.
Hi Sir,
these commands I have used
for ii=1:size(Training_Gen{1},2)
if ii<=14
tar(ii)=1;
tar2(ii)=0;
elseif ii>14
tar(ii)=0;
tar2(ii)=1;
end
end
target=vertcat(tar,tar2);
% % % Create a Pattern Recognition Network
hiddenLayerSize = 30;
net = patternnet(hiddenLayerSize);
% % % Train the Network
[net,tr] = train(net,input,target);
sorry, if u used this command, the resulted Target Matrix always 1 !!!?
when I use this approach, the results are very bad! does that mean what I have done (in my code) to creat the Target Matrix is wrong?
The resulting target matrix is not all 1. The resulting target matrix is sparse, so it only shows the non-zero entries. You can use
full(target)
to see the 0's and 1's in context.
"does that mean what I have done (in my code) to creat the Target Matrix is wrong"
Given that the first 14 entries belong to one class and the next 144 entries belong to another class, all you need for the target matrix is
target = ind2vec( [ones(1,14),2*ones(1,144)] );
No loops, no "if".
If this gives poor results then either you are not correct about which samples belong to which class, or else your classes are not well separated.
It might help to do feature selection such as pca.
I see :( thank you so much, ok the output of neural network will be two rows and N number of columns!. in order to calculte the Equal Error Rate, which one should I take the first row of the second?

Sign in to comment.

More Answers (0)

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!