MATLAB Answers

Query regarding Artificial neural network

Asked by Ampi

Ampi (view profile)

on 28 Oct 2012
Accepted Answer by Greg Heath

Greg Heath (view profile)

Hello could you please help me out with the answer of a question? 1. Say I am performing Face Recognition using PCA, now I have found out say 100 vectors i.e. eigenvectors of few classes. I have also set up the target matrix to train those vectors. Now, my question is when I am setting up the training ststem I have wriiten the matlab command as:- net=newff(final,target,9) where 9 is no. of layers of perceptrons, where final is the tarining samples. Now since I have 100 sample vectors , I may increase the no of vectors, so my question is should I increase the layers of perceptrons or how should I choose the 3rd argument in newff function. For training of 100 vectors is 9 layer of perceptrons ok? I shall be grateful to you if you kindly answer my question

Products

No products are associated with this question.

1 Answer

Greg Heath (view profile)

Answer by Greg Heath

Greg Heath (view profile)

on 30 Oct 2012
Accepted answer

CORRECTION: You have one hidden layer with H = 9 hidden nodes. Do not use more hidden layers.

Design an I-H-O MLP for classification of O = c classes:

Use newpr (calls newff) or patternnet (calls feedforward net)

Input matrix x contains N I-dimensional column vectors

Target matrix t contains N O-dimensional unit column vectors with the row of the "1" indicating the class of the corresponding input vector.

Ntrn = 0.7*N % Default number of training examples

Ntrneq = Ntrn*O % Number of training equations

Nw = (I+1)*H +)H+1)*O % Number of unknown weights to estimate

H < < (Ntrneq-O)/(I+O+1) % Ntrneq > > Nw is desired

rng(0)

j=0

for h = 1:dH: Hmax

`   j=j+1`
`   for i = 1:Ntrials`
`       net = newpr(x,t,h);`
`       [net tr ] = train(net,x,t);`

% tr = tr % Important diagnostic info when needed

`        y = net(x);`
`       classes = vec2ind(y);`
`       fill this in`
```       PctErr(i,j) = ...
end
end```

etc

Hope this helps.

Thank you for formally accepting my answer.

Greg

Join the 15-year community celebration.

Play games and win prizes!

Learn more

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!