Discover MakerZone

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

New to MATLAB?

Newbie question on how to change default settings for feedforwardnet

Asked by Jo John

Jo John (view profile)

on 22 Jul 2012
Latest activity Commented on by Image Analyst

Image Analyst (view profile)

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


Jo John

Jo John (view profile)

1 Answer

Answer by Greg Heath

Greg Heath (view profile)

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.




huang (view profile)

on 17 Oct 2013

thank you!very detail answer

Image Analyst

Image Analyst (view profile)

on 29 Oct 2013

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

Greg Heath

Greg Heath (view profile)

Contact us