How to add 2 or more hidden layer to the neural network?
1 次查看(过去 30 天)
显示 更早的评论
I have this code i need to add 2 hidden layer, can anyone please help me with that please. Here is the code
[J,grad] = netcost(nn_params,input_layer_size,hidden_layer_size,num_labels,X, y, lambda)
Theta1 = reshape(nn_params(1:hidden_layer_size * (input_layer_size + 1)), ... hidden_layer_size, (input_layer_size + 1));
Theta2 = reshape(nn_params((1 + (hidden_layer_size * (input_layer_size + 1))):end), ... num_labels, (hidden_layer_size + 1));
num_labels=2; 1 hidden layer; input neurons=2160,hidden layer neuron=20; I want to add totally 2 hidden layers, please can anyone help me with the code please
9 个评论
Philip G
2017-4-20
编辑:Philip G
2017-4-20
Just executing the command
net=feedforwardnet([200 200 200]);
Does not give any errors and will give you a network with 3 hidden layers of size 200 (see attached image). I am not sure what your error is. Also in the code above "netcost" is not a MATLAB function - so it is hard to say where your error comes from (especially this strange behavior that you can not create a network with a layer size bigger than 100).
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!