More than one hidden layer

2 次查看(过去 30 天)
Rafa
Rafa 2011-11-6
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 个评论
Nduwamungu Corneille
Hi Rafa, have you managed to solve the default single hidden layer issue? Thank you. Corneille
Greg Heath
Greg Heath 2013-6-4
See my answer.
Greg Heath

请先登录,再进行评论。

采纳的回答

Greg Heath
Greg Heath 2011-11-23
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

更多回答(2 个)

Walter Roberson
Walter Roberson 2011-11-6
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 个评论
Walter Roberson
Walter Roberson 2011-11-6
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 2011-11-7
I wrote a comment to Dimitris.
Take a look please!
Thank you!

请先登录,再进行评论。


Dimitris
Dimitris 2011-11-6
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 个评论
Rafa
Rafa 2011-11-6
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

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by