Effacer les filtres
Effacer les filtres

How to Loop the neural network training to choose the best performance?

1 vue (au cours des 30 derniers jours)
Chin Kui Ku
Chin Kui Ku le 31 Juil 2018
Commenté : Chin Kui Ku le 1 Août 2018
Hi, I need some help on how to train a network for different value of Neurons, and save the MSE then choose the best MSE to select the best trained network.
I am using the fitnet as follows:
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network & set number of neurons
hiddenLayerSize = 30;
net = fitnet(hiddenLayerSize,trainFcn);
[net,tr] = train(net,X,T);
testX = X(:,tr.testInd);
testT = T(:,tr.testInd);
testY = net(testX);
perf = mse(net,testT,testY)

Réponse acceptée

KSSV
KSSV le 31 Juil 2018
  3 commentaires
KSSV
KSSV le 1 Août 2018
N = [ 5, 10, 15, 20, 25, 30, 35, 40. ];
NN = cell(length(N),1) ;
P = zeros(length(N),1) ;
for i = 1:length(N)
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network & set number of neurons
hiddenLayerSize = N(i);
net = fitnet(hiddenLayerSize,trainFcn);
[net,tr] = train(net,X,T);
NN{i} = net ;
testX = X(:,tr.testInd);
testT = T(:,tr.testInd);
testY = net(testX);
perf = mse(net,testT,testY) ;
P(i) = perf ;
end
Chin Kui Ku
Chin Kui Ku le 1 Août 2018
Thank you very much!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by