MATLAB Answers

Jo John

Newbie question on how to change default settings for feedforwardnet

Asked by Jo John
on 22 Jul 2012
Latest activity Commented on by Image Analyst
on 29 Oct 2013

I am learning neural networks via MATLAB 2012a, I followed some examples. In one of the examples I found internet, create a feed forward net with 2 hidden layers, the first layer has 3 neurons and the second layer has 1 neuron. From the default feed forward net created by: net = feedforwardnet I can see there are 2 hidden layers, but I can not see how many neurons are there in each layer.

Please advice how I can find the settings in each layer for how many neurons are in the layer? Besides, how I can change it?

I found an old syntax seems to be able to do this quite easily: net = newff([1969, 1989; 1,12], [3, 1], {‘tangsig’, ‘purelin’}, traind) However, in MATLAB 2012a, the above syntax is obsolete, please let me know how I can do the same job with feedforwardnet?

Thanks, John


Log in to comment.

1 Answer

Answer by Greg Heath
on 25 Jul 2012
 Accepted Answer

1. Your example only has 1 hidden layer. The other layer is the output layer. I sincerely doubt that you will ever have to use two hidden layers.

    For two hidden layers:
    newff([minmax(x),t,[H1 H2 O],...)% Ancient ( O = size(t,1) )
    newff(x,t,[H1 H2],...)           % Very Old
    newfit(x,t,[H1 H2],...)          % Old
    fitnet(x,t,[H1 H2],...)          % Current

2. If you have 2012a

    a. Forget about feedforwardnet (automatically called by fitnet and patternnet)
    b. Use fitnet for regression and curvefitting 
    c. Use patternnet for pattern recognition and classification

3. Read the documentation to better understand

 help fitnet
 doc fitnet
 help/doc patternnet
 help/doc feedforwardnet
 help/doc newff

4. Run some of the examples and/or demos WITH THE ENDING SEMICOLONS REMOVED!

5. Study the resulting command line output.

Hope this helps.



I marked Greg's answer as Accepted, because you forgot to.

Log in to comment.

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today