Question

All I need is to know how the neural network works and how the associations between input and output are done. For example:

p = [1  0  1  0  1
 0  1  1  0  1
 1  0  0  1  1
 0  1  0  1  1
 1  0  0  1  1];

t = [0 0 1 0 0
 0 0 0 0 1
 1 0 0 0 0
 0 1 0 0 0
 0 0 0 1 0];

PR = [0 1;0 1;0 1;0 1;0 1];
net = newff(PR,[5 25 25 5],{'logsig','logsig','logsig','logsig'},'traingda');
net.trainParam.epochs = 1500;
net.trainParam.goal = 0;
net = train(net,p,t);

Then try to simulate the first feature.

sim(net,p(:,1))

And the result :

ans =

  0.0032
  0.0003
  0.9955
  0.0000
  0.0029

Why is the third class now the one that is chosen? And how to make, for example, the first class match the 5th class? Can you please describe what the sizes of the input and target matrices should be?

For example when creating an input matrix of 5x5 then what should the size of the target matrix be?

Was it helpful?

Solution

If you call sim with p(:,1), the expected result is t(:,1), which in this case is:

>> t(:,1)

ans =

     0
     0
     1
     0
     0

So, the result of sim seems fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top