I am creating a neural network using MATLAB (version specified in title).
After reading the documentation and research on the internet, I am still confused as to whether net.numLayers includes the input layer.
In other words, if I want to create a 3-Layer neural network as follows:
Input Layer – Hidden Layer – Output Layer
should I specify
net.numLayers = 3 or net.numLayers = 2?
I am confused because there is a command net.inputs{i}.range where i specifies the index on the input layer. May I remind you that i is “0” if it does not exist, otherwise it should be a positive integer. (Please refer to the documentation for more details)
However many tutorials on the internet which seem reliable are making me think otherwise:
http://www-cs.ccny.cuny.edu/~csolb/CscI1900/xor.htm
http://web.eecs.umich.edu/~someshs/nn/matlab_nn_starter.htm
If you have a look at the links provided, you will realize that they build a neural network for the XOR function. I am aware that the version of MATLAB may be different, however most of the commands are the same, otherwise in the newer version there is different syntax for the equivalent functionality. In both tutorials the number of layers specified is 2 (for hidden and output layer), but the second tutorial makes use net.layers{1}.transferFcn = 'logsig'; where “1” would definitely be referring to the hidden layer.
If someone could clarify this it would be very helpful.
I look forward to reading some answers. Thank you.
No it does not include the input layer.
Here is a trick, after you have created your network (say, net=feedforwardnet(10), where the 10 is the size of your input layers). You could type view(net) to get a visual view of the network