Neural Network for 2 classes as input and 2 output
3 次查看(过去 30 天)
显示 更早的评论
Hello
I have images of size 28x28x3 so the feature for each image will be 2352x1. I have two classes and each class have 700 images (for example) so the input variable x is 1400x2352 (format double) and labels are 1x1400 (700 0's ; 700 1's). Matlab code for the NN architecture is :
net = feedforwardnet([2 2 2]);
net.divideFcn = 'dividerand';
net.divideParam.trainRatio = 0.7;
net.divideParam.valRatio = 0.15;
net.divideParam.testRatio = 0.15;
[net,tr] = train(net,x,target_labels);
the net is shown like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167392/image.jpeg)
isn't should be 2 input, 10 hidden layers and 2 outputs?
0 个评论
回答(1 个)
Greg Heath
2017-9-21
1. You made a transcription error. Your code erroneously shows [ 2 2 2] whereas the figure is consistent with [ 2 10 2]
2. You made a conceptual error: The net creation statement does not include input and output dimensions. It only states number of nodes for each hidden layer. Therefore you have 5 layers, input, output and 3 hidden.
3. The number of nodes in the input and output layers are determined by the dimensions of the input and target vectors, respectively.
4. Remember the numbers in the creation statement are the number of nodes in each hidden layer, the number of numbers is the number of hidden layers.
Hope this helps.
Thank you for formally accepting my answer
Greg
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!