MATLAB: How to initialize target matrix of a Neural-Network

how to initialize target matrix of a neural-network ?

Hello, My question is :-
1. For PCA and Eigenbased Face Recognition, I am reshaping 30 images into a 2D array where each row of the 2-D matrix denotes the vectors of a single face. My question is :- for generating the training vector set, how should I initialize the target vector of ANN(Artificial Neural network)so that I can perform the recognition correctly ? Any help would be appreciated and thank you in advance.
With regards, Ampi B.

Best Answer

I assume you are using patternnet.
Your N I-dimensional input vectors should be columns (not rows) of an IxN input matrix.
For c classes, your N c-dimensional target vectors should be columns of a cXN target matrix. The target vectors should be columns of the c-dimensional unit matrix eye(c). The row index of the "1" is the class index of the corresponding input vector.
Hope this helps.
Thank you for formally accepting my answer.
Greg