- Training function: trainlm
- Learning function: learngdm
- Performance function: MSE
Neural Network with learngdm as adaptation learning function
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Diego Mauricio Beramendi Ortega
am 12 Jul. 2022
Beantwortet: aditi bagora
am 19 Okt. 2023
Hi all,
I need to apply a ANN to solve a regression problem. The network must have three inputs and one output. The network type is Feed-forward back propagation, the training function is trainlm, the adaptation learning function is learngdm, the performance function is MSE and the network could have one hidden layer. So far, I applied nntool to solve this problem but I later I have to use a for loop to built the network many times with different ANN parameters (e.g. number of hidden layers). Could anyone give me a small example of matlab code to construct a ANN with the mentioned characteristics? I am having problems to implement learndgm as learning function. A portion of the data I am using is attached to this post.
Thanks in advance.
0 Kommentare
Antworten (1)
aditi bagora
am 19 Okt. 2023
Hello Diego,
I understand that you are trying to build an ANN with hidden layer of varying sizes and following parameters.
I am attaching a sample code that creates an ANN with the given parameters. You can use the “createnetwork()” function to define network with varying hidden layer sizes.
net = createnetwork([10,8]); % create a network
% number_hidden_layers is a vector of number of neurons required in each layer [10,8] means a network with 2 layers of sizes 10 and 8 respectively.
function net = createnetwork(number_hidden_layers)
net = feedforwardnet(number_hidden_layers); % Specify the number of hidden layers and neurons per layer
% Set the training function, adaptation learning function, and performance function
net.trainFcn = 'trainlm';
net.adaptFcn = 'learngdm';
net.performFcn = 'mse';
% Divide the data into training, validation, and testing sets
net.divideFcn = 'dividerand';
net.divideMode = 'sample';
net.divideParam.trainRatio = 0.7;
net.divideParam.valRatio = 0.15;
net.divideParam.testRatio = 0.15;
end
Hope this helps!
Regards,
Aditi
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!