More than one hidden layer
6 views (last 30 days)
Show older comments
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 Comments
Nduwamungu Corneille
on 3 Jun 2013
Hi Rafa, have you managed to solve the default single hidden layer issue? Thank you. Corneille
Accepted Answer
Greg Heath
on 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
0 Comments
More Answers (2)
Walter Roberson
on 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 Comments
Walter Roberson
on 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.
Dimitris
on 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');
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!