- Training function: trainlm
- Learning function: learngdm
- Performance function: MSE
Neural Network with learngdm as adaptation learning function
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
aditi bagora
il 19 Ott 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 Commenti
Vedere anche
Categorie
Scopri di più su Sequence and Numeric Feature Data Workflows in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!