More than one hidden layer

3 Ansichten (letzte 30 Tage)
Rafa
Rafa am 6 Nov. 2011
Hi, I am using the command net =newff(p,t,3);
So, my neural netwok has one hidden layer with 3 neurons.How can i increase the number of hiiden layers?
And how can change the activations functions from default?
Please i need an example.
Thanks
  2 Kommentare
Nduwamungu Corneille
Nduwamungu Corneille am 3 Jun. 2013
Hi Rafa, have you managed to solve the default single hidden layer issue? Thank you. Corneille
Greg Heath
Greg Heath am 4 Jun. 2013
See my answer.
Greg Heath

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Greg Heath
Greg Heath am 23 Nov. 2011
Dimitris used the older version of newff
net = newff(minmax(p),[H1 H2 O],{'tansig' 'tansig' 'tansig'});
for a net with I-H1-H2-O node topology. The newer version is
net = newff(p,t,[H1 H2],{'tansig' 'tansig' 'tansig'});
Hope this helps.
Greg

Weitere Antworten (2)

Walter Roberson
Walter Roberson am 6 Nov. 2011
I am definitely not an expert on this, but my interpretation of the documentation is that the number of layers is strictly determined by size(t,1). If that is correct, then to increase the number of hidden layers, you would have to increase the number of rows in t .
The users guide appears to suggest that all but the last layer are "hidden" layers and the last layer is not hidden, but the reference page above shows an example with a single row T (thus only one layer) and indicates that that creates a network with one hidden layer when my interpretation would instead suggest no hidden layer would be created. The possible conclusions are that either I have misunderstood the documentation or else that (by convention?) a single row input will lead to a two layer network with the first layer hidden and the second layer being the output layer.
  3 Kommentare
Walter Roberson
Walter Roberson am 6 Nov. 2011
The documentation I cited (the R2010a reference page for newff) does not say that.
On the other hand, reading again, I believe I was wrong about the number of layers being determined by the number of rows. Instead, in now appears to me that the number of layers is one more than the number of size (Si) parameters that you provide. Thus,
newff(p,t,[3 3])
would, I think, create two hidden layers both with 3 neurons.
Rafa
Rafa am 7 Nov. 2011
I wrote a comment to Dimitris.
Take a look please!
Thank you!

Melden Sie sich an, um zu kommentieren.


Dimitris
Dimitris am 6 Nov. 2011
Try that for a 10:3:3:5 NN with specific activation functions.The range of input is [-1,1].
net=newff([-1 1; -1 1; -1 1; -1 1; -1 1; -1 1; -1 1; -1 1; -1 1; -1 1], [3 3 5],{'tansig','tansig','tansig'},'trainlm');
  1 Kommentar
Rafa
Rafa am 6 Nov. 2011
According to the documentation from the help of Matlab R2008a:
newff (P, T, [S1 S2 ... S (Nl)], {TF1 TF2 ... TFNl}, BTF, BLF, PF, IPF, OPF, DDF) Several arguments takes
He did not cite how to put more than one hidden layer and therefore ask for help.
[.. S1 S2 S (N-1)] is the size of the hidden layer.
This help is also cited an example of newff net = (P, T, 5), where five neurons are created in a single hidden layer set to default.
Dimitri, until I realized that you put the ranges of input neurons and you only desceveria matrices of input and output in the training ne? But that is not quoted in the Matlab help for the command newff.
I still need help with examples on how to place two or more hidden layers using newff.
thank you

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by