Artificial Neural Networks Hidden Layers
41 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tiago Dias
am 25 Jul. 2019
Beantwortet: Sneha Bachhu
am 12 Nov. 2020
Hello,
Below is my code to build a neural netword.
Question 1
n defines the number of nodes in the hidden layer. How can i define more nodes to the output hidden layer? or the fact it is 1 because i have only 1 output variable?
Question 2
Is it possible to set, for example, 2 hidden layers, of 15 neuros and 5 neuros respectively?
---------------------------------
%% ANN --------------------------------------------------------------------
% Define X
X = predictors;
% Define Y
Y = Y_MOTOR;
% Define a neural network (variable called 'net' which is a 3 layer
% perceptron with n nodes in the hidden layer
n = 25;
net = feedforwardnet(n);
% Train network
[net, TR] = train(net, X', Y');
% Prediction
Y_model = zeros(length(Y),1);
for i = 1:length(Y)
% Simulate Neural Network
Y_model(i) = net([X(i,:)]');
% Input of net, must be a column vector
end
Thanks for your time
0 Kommentare
Akzeptierte Antwort
Greg Heath
am 25 Jul. 2019
Number of input and output nodes is determined by the data.
Number of hidden layers and nodes is determined by the program author.
Hope this helps
Thank you for formally accepting my answer,
Greg
Weitere Antworten (1)
Sneha Bachhu
am 12 Nov. 2020
Hi all,
I am working on neural network to study cancer data, using test and training datasets, with the hidden layers ranging 5 to 100 and for 4 different ANNs 1,2,5,10. Exit condition for ANN is at least 2000 epochs.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!