How to use setwb?

조회 수: 2 (최근 30일)
John F
John F 2021년 12월 4일
Say I have an already fully configured Neural Network net. I am trying to write the algorithm for the cascade k-fold cross validation of this network. For the first fold I initialize the weights randomly (using initnw). I would like all following folds to get the weights that resulted from the training of the previous fold using initwb and setwb. The relevant code snippet looks like the following:
for i=1:numberOfFolds
if (i==1)
net = init(net); % Random initialization
else
% bestIW{i-1} and bestLW{i-1} are the net.IW and net.LW
% of the best trained network of the previous fold
net.layers{1:end}.initFcn = 'initwb';
net = setwb(net,[bestIW{i-1},bestLW{i-1}]);
end
end
When I run the full code I get the following error message:
Index exceeds the number of array elements (12).
I'm not sure how to format the second arguement of the setwb command in order for this to work. Also, do I need to run init(net) after setwb?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by