From: Tahereh Marvdashti on
Hello,

I'm working on a classification problem. I'm using MATLAB's already defined commands to create and train a feed-forward ANN. Principal component analysis is employed on the input data and then the new reduced dimensions inputs are fed to the ANN:

[inputn,ps1] = mapstd(input);
[inputtrans,ps2] = processpca(inputn,0.02);
[num_row,num_column] = size(inputtrans);
num_neurons = 5*num_row;
net = newff(inputtrans,output,num_neurons);
net = train(net,inputtrans,output);

I'm not getting the accuracy I expected. The only part that I have doubts about is how to set the input/output structure . There are 3 different classes so each input corresponds to either class A,B or C. The output is a vector of 3 elements: If for example input x belongs to class A, the output is [1 0 0] , if it belongs to class B, the output is [0 1 0] and if it belongs to class C, the output is [0 0 1]. I created and trained the network with this input/output structure (The above code). The below code is for the purpose of testing:

test_inputn = mapstd('apply',test_input,ps1);
test_inputtrans = processpca('apply',test_inputn,ps2);
test_output = sim(net,test_inputtrans);

So I got for example [-.05 .8 .9] for test_output. What I did at this point was to assign the class to the largest element of the test_output, for example in this case class C will be assigned to test_output. Is this OK or the best way to solve a classification problem? Please any advice would highly be appreciated.

Thanks,