Do we need to reinitialized the weight using "init(net)" to reinitialized the weights in ANN training loop?
1 view (last 30 days)
Show older comments
Hi, i need help on whether should re-initialized the weight when looping the training for different neurons number? will the training function re-initialized the weight by defautlt? the code i used are as follows. thank you very much.
N = [5 10 15 20 25 30 35 40 45 50 55 60];
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
%name the ANN NNxxpts
NNVFBRReal200_5_to_60_all = cell(length(N),1) ;
P = zeros(length(N),1) ;
for i = 1:length(N)
% Create a Fitting Network & set number of neurons
hiddenLayerSize = N(i);
net = init(net);
net = fitnet(hiddenLayerSize,trainFcn);
net.performFcn = 'mse'; % Mean Squared Error
% Choose Plot Functions
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression'};
[net,tr] = train(net,X,T);
nntraintool
NNVFBRReal200_5_to_60_all{i} = net ;
testX = X(:,tr.testInd);
testT = T(:,tr.testInd);
testY = net(testX);
perf = mse(net,testT,testY) ;
P(i) = perf ;
end as i encountered very high MSE when using trainBr. as below.
please help. however , in another case, it only occured at neurons = 35
Please help. thanks
0 Comments
Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!