Neural Network options Output net work, 'best-validation-loss'

5 ビュー (過去 30 日間)
Miao Yang
Miao Yang 2021 年 10 月 28 日
回答済み: Niccolò Dal Santo 2021 年 11 月 10 日
I use simple feed forward neural network only 2 layers with miniBatchSize, and inside the neural network options, I use adam for solver option, and 'OutputNetwork' is 'best-validation-loss'. But the error message says outputNetwork is not an option for solver Adam. Then I tried sgdm, and rsprop, the rest of 2 options Matlab offered for solver. The error message still there and says outputnetwork is not an option fo solver sgdm, and rsprop respectively. I wonder how to set outputnetwork to be best-validation-loss since it fails under all solver options ?
  3 件のコメント
Miao
Miao 2021 年 10 月 28 日
%TTr is training table, reponse variable is last column named exRet.
numFeatures = size(TTr,2)-1; % all numeric data, no categorical.
layers = [
featureInputLayer(numFeatures)
fullyConnectedLayer(32)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(16)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(1)
regressionLayer
];
miniBatchSize = 100;
num = height(TTr)/miniBatchSize; % total training observation/batch size = number of batch
options = trainingOptions('adam',...
'MiniBatchSize',miniBatchSize,...
'InitialLearnRate',0.001,...
'ValidationData',TVa,...
'ValidationPatience',5,...
'ValidationFrequency',round(num),...
'OutputNetwork','best-validation-loss',...
'Shuffle','every-epoch',...
'MaxEpochs',500,...
'L2Regularization',0.001,...
'Plots','training-progress', ...
'Verbose',false);
net = trainNetwork(TTr,'exRet',layers,options);
When I run the code above, error message is below, the version my matlab is 2021a, should I update to 2021b then maybe it work ok?
Error using nnet.cnn.TrainingOptionsADAM (line 132)
'OutputNetwork' is not an option for solver 'adam'.
Error in trainingOptions (line 317)
opts = nnet.cnn.TrainingOptionsADAM(varargin{:});
Error in tryneural (line 25)
options = trainingOptions('adam',...
Taylor Chu
Taylor Chu 2021 年 11 月 9 日
I'm getting the same error but only when I'm running it on cluster which I assume is running linux. I've tried running the same script (my script) on windows and it runs fine with the 'OutputNetwork', 'best-validation-loss' training option. Removing that option works on cluster but it does not really solve the problem

サインインしてコメントする。

回答 (1 件)

Niccolò Dal Santo
Niccolò Dal Santo 2021 年 11 月 10 日
Hi Miao,
The 'OutputNetwork', 'best-validation-loss' training option is available in R2021b or later versions. Which MATLAB version are you using? You can obtain the version with the following command:
>> version
ans =
'9.11.0.1751886 (R2021b)'
Cheers,
Niccolò

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by